Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False-positive warnings in hash functions #664

Open
Azq2 opened this issue Jan 5, 2025 · 0 comments
Open

False-positive warnings in hash functions #664

Azq2 opened this issue Jan 5, 2025 · 0 comments

Comments

@Azq2
Copy link

Azq2 commented Jan 5, 2025

Not a problem, but may be better change unsigned char block[64] to unsigned char *block

In function 'HV_MD5Update',
    inlined from 'HV_MD5Final' at libhv/util/md5.c:86:5:
libhv/util/md5.c:69:13: warning: 'HV_MD5Transform' accessing 64 bytes in a region of size 8 [-Wstringop-overflow=]
   69 |             HV_MD5Transform(ctx->state,&input[i]);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libhv/util/md5.c:69:13: note: referencing argument 2 of type 'unsigned char[64]'
libhv/util/md5.c: In function 'HV_MD5Final':
libhv/util/md5.c:111:6: note: in a call to function 'HV_MD5Transform'
  111 | void HV_MD5Transform(unsigned int state[4],unsigned char block[64]) {
      |      ^~~~~~~~~~~~~~~
[ 95%] Building C object third_party/libhv/CMakeFiles/hv_static.dir/util/sha1.c.o
In function 'HV_SHA1Update',
    inlined from 'HV_SHA1Final' at libhv/util/sha1.c:260:5:
libhv/util/sha1.c:214:13: warning: 'HV_SHA1Transform' reading 64 bytes from a region of size 0 [-Wstringop-overread]
  214 |             HV_SHA1Transform(context->state, &data[i]);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libhv/util/sha1.c:214:13: note: referencing argument 2 of type 'const unsigned char[64]'
libhv/util/sha1.c: In function 'HV_SHA1Final':
libhv/util/sha1.c:49:6: note: in a call to function 'HV_SHA1Transform'
   49 | void HV_SHA1Transform(
      |      ^~~~~~~~~~~~~~~~
In function 'HV_SHA1Update',
    inlined from 'HV_SHA1Final' at libhv/util/sha1.c:264:9:
libhv/util/sha1.c:214:13: warning: 'HV_SHA1Transform' reading 64 bytes from a region of size 0 [-Wstringop-overread]
  214 |             HV_SHA1Transform(context->state, &data[i]);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libhv/util/sha1.c:214:13: note: referencing argument 2 of type 'const unsigned char[64]'
libhv/util/sha1.c: In function 'HV_SHA1Final':
libhv/util/sha1.c:49:6: note: in a call to function 'HV_SHA1Transform'
   49 | void HV_SHA1Transform(
      |      ^~~~~~~~~~~~~~~~

$ arm-linux-gnueabihf-g++ -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/14.2.0/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../gcc-14.2.0/configure --target=arm-linux-gnueabihf --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --program-prefix=arm-linux-gnueabihf- --libdir=/usr/lib --libexecdir=/usr/lib --with-local-prefix=/usr/arm-linux-gnueabihf --with-sysroot=/usr/arm-linux-gnueabihf --with-build-sysroot=/usr/arm-linux-gnueabihf --with-native-system-header-dir=/include --with-as=/usr/bin/arm-linux-gnueabihf-as --with-ld=/usr/bin/arm-linux-gnueabihf-ld --with-linker-hash-style=gnu --with-system-zlib --with-arch=armv6 --with-float=hard --with-fpu=vfp --enable-languages=c,c++,lto,m2 --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-plugin --enable-shared --enable-threads=posix --enable-libquadmath --enable-libvtv --disable-nls --disable-install-libiberty --disable-libssp --disable-libstdcxx-pch --disable-multilib --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (GCC) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant