Closed thomwiggers closed 3 years ago
This is expected. The code reads 32 bytes from buf but uses only the lower 24 bytes. So it can read up to 8 bytes past the buffer but they are never used and buf lies on the stack so everything should be fine. One could enlarge the buffer by 8 bytes to silence this warning. The same applies to the rej_gamma1m1_avx.
While it may work, it's still undefined behavior to read past the buffer as far as I understand the C standard. Furthermore, it means that any library including this software is precluded from using -fsanitize
or Valgrind. I don't think that's acceptable, especially if the cost is a mere 8 bytes (probably more is added by the compiler when aligning).
Fixed now (see PR #33)
When compiling the AVX2 code with
-fsanitize=address,undefined
, the./test/test_dilithiumXaes
executables crash with the following message (gcc 10.1.0
):Interestingly, the
PQCgenKAT
executables run fine.