Skip to content

False-positive warnings in hash functions #664

Open
@Azq2

Description

@Azq2

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) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions