slide_hash knowingly reads (possibly) uninitialised memory, see comment lower down about prev[n] potentially being garbage. In this case, the result is never used - so we don't care about MSAN complaining about this read. By adding the no_sanitize("memory") attribute, clients of zlib won't see this (unnecessary) error when building and running with MemorySanitizer. An alternative approach is for clients to build zlib with -fsanitize-ignorelist=... where the ignorelist contains something like 'fun:slide_hash'. But that's more work and needs to be redone for any and all CI systems running a given project with MSAN. Adding this annotation to zlib's sources is overall more convenient - but also won't affect non-MSAN builds. This specific issue was found while running git's test suite, but has also been reported by other clients, see e.g. #518.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
CMakeLists.txt | Loading commit data... | |
COPYING | Loading commit data... | |
adler32.c | Loading commit data... | |
crc32.c | Loading commit data... | |
crc32.h | Loading commit data... | |
deflate.c | Loading commit data... | |
deflate.h | Loading commit data... | |
gzguts.h | Loading commit data... | |
infback.c | Loading commit data... | |
inffast.c | Loading commit data... | |
inffast.h | Loading commit data... | |
inffixed.h | Loading commit data... | |
inflate.c | Loading commit data... | |
inflate.h | Loading commit data... | |
inftrees.c | Loading commit data... | |
inftrees.h | Loading commit data... | |
trees.c | Loading commit data... | |
trees.h | Loading commit data... | |
zconf.h | Loading commit data... | |
zlib.h | Loading commit data... | |
zutil.c | Loading commit data... | |
zutil.h | Loading commit data... |