From: Mark Adler Date: Wed, 29 Jul 2015 06:13:53 +0000 (-0700) Subject: Avoid uninitialized access by gzclose_w(). X-Git-Tag: 1.9.9-b1~793^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e283a44a9e4e0ee64b6dfb7b352f0440d64c187c;p=thirdparty%2Fzlib-ng.git Avoid uninitialized access by gzclose_w(). (cherry picked from commit c901a34c92c4aa74028f541a9773df726ce2b769) Conflicts: deflate.c --- diff --git a/deflate.c b/deflate.c index 65a9163a8..ec770ff72 100644 --- a/deflate.c +++ b/deflate.c @@ -584,7 +584,7 @@ int ZEXPORT deflate(z_stream *strm, int flush) { } s = strm->state; - if (strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0) || + if (strm->next_out == Z_NULL || (strm->avail_in != 0 && strm->next_in == Z_NULL) || (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } diff --git a/gzwrite.c b/gzwrite.c index 58b589797..8c8078177 100644 --- a/gzwrite.c +++ b/gzwrite.c @@ -45,6 +45,7 @@ local int gz_init(gz_statep state) { gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; } + strm->next_in = NULL; } /* mark state as initialized */