torognes / vsearch

Versatile open-source tool for microbiome analysis
Other
643 stars 123 forks source link

warnings with recent GCC (possible false-positives) #509

Closed frederic-mahe closed 1 year ago

frederic-mahe commented 1 year ago

@torognes if these are false positives, then please feel free to close the issue.

With gcc 12 and more recent:

In function 'SHA1_Update',
    inlined from 'SHA1_Final' at sha1.c:245:5:
sha1.c:220:13: warning: 'SHA1_Transform' reading 64 bytes from a region of size 1 [-Wstringop-overread]
  220 |             SHA1_Transform(context->state, data + i);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha1.c:220:13: note: referencing argument 2 of type 'const uint8_t[64]' {aka 'const unsigned char[64]'}
sha1.c: In function 'SHA1_Final':
sha1.c:131:6: note: in a call to function 'SHA1_Transform'
  131 | void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
      |      ^~~~~~~~~~~~~~
In function 'SHA1_Update',
    inlined from 'SHA1_Final' at sha1.c:247:9:
sha1.c:220:13: warning: 'SHA1_Transform' reading 64 bytes from a region of size 1 [-Wstringop-overread]
  220 |             SHA1_Transform(context->state, data + i);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha1.c:220:13: note: referencing argument 2 of type 'const uint8_t[64]' {aka 'const unsigned char[64]'}
sha1.c: In function 'SHA1_Final':
sha1.c:131:6: note: in a call to function 'SHA1_Transform'
  131 | void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
      |      ^~~~~~~~~~~~~~

No warning with clang-16 or clang-17 (alpha version).

torognes commented 1 year ago

I am pretty sure this is a false positive. It is old public domain code, that we have never experienced problems with.