[Zlib-devel] [PATCH] One remaining Valgrind error
Mark Adler
madler at madler.net
Fri Aug 24 18:10:48 EDT 2012
On Aug 16, 2012, at 12:03 PM, Jan Seiffert wrote:
> This is a real error:
> 275 have = strm->next_in + strm->avail_in - state->in;
> 276 if (have < state->size) {
>
> state->in is not initialized, so "have" is bogus.
Jan and Daniel,
Thanks -- fixed that. I introduced that bug very recently when trying to avoid writing to pointers derived from strm->next_in, in order to clean up the const business. So I used state->in, but did not read my own comment right before that code which says "(state->size == 0 if buffer not initialized)". As Jan noted, there is strictly speaking no actual bug in the resulting code, since the same uninitialized value is subtracted from itself (strm->next_in is set to state->in immediately before the above code). However the patch avoids the valgrind complaint.
Of course, a memset in deflate would not have avoided that particular valgrind error.
I will take a look at the valgrind's complaint about fill_window().
Thanks
More information about the Zlib-devel
mailing list