oxen-io/oxen-core

stringop-overflow error when building with gcc 12.x

ianmacd opened this issue · 2 comments

I upgraded my laptop to Fedora 36 yesterday and evidently inherited a newer gcc:

$ gcc --version
gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This leads to the following error during compilation:

[ 50%] Building C object src/crypto/CMakeFiles/cncrypto.dir/oaes_lib.c.o
/home/ianmacd/src/oxen-core/src/crypto/oaes_lib.c: In function ‘oaes_encrypt’:
/home/ianmacd/src/oxen-core/src/crypto/oaes_lib.c:1276:52: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 1276 |                         _block[ _block_size + _j ] = _j + 1;
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/ianmacd/src/oxen-core/src/crypto/oaes_lib.c:1269:25: note: at offset 16 into destination object ‘_block’ of size 16
 1269 |                 uint8_t _block[OAES_BLOCK_SIZE];
      |                         ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [src/crypto/CMakeFiles/cncrypto.dir/build.make:286: src/crypto/CMakeFiles/cncrypto.dir/oaes_lib.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1475: src/crypto/CMakeFiles/cncrypto.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I will post a patch after filing this issue.

Red Hat 12.1.1-1

The hell is RedHat doing? There is no such published gcc release (12.1.0 is the latest).

I see; they built from a 12.1.x git snapshot and mis-labelled the release as a final 12.1.1. Yay RedHat.