zlib generating valgrind warnings

Mike assumes that zlib is valgrind clean. In actual fact there are a number of cases where loop unrolling in the zlib library causes the mentioned “Conditional jump or move depends on uninitialised value(s)” warnings. These are safe since the results of the comparison are subsequently ignored but obviously valgrind doesn’t know that. This is discussed briefly in the zlib FAQ. It is safe since the memory being read was allocated by zlib (so it knows the pointer is valid) and the results of the calculations are discarded by bounds checking done after the loop exits.

Recent valgrind packages should have rules that suppress the spurious warnings from zlib, though I don’t know if the rules manage to cover all the relevant cases or not and obviously it is still possible to pass uninitialised data into zlib.

Leave a Reply