]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Avoid uninitialized access by gzclose_w().
authorMark Adler <madler@alumni.caltech.edu>
Wed, 29 Jul 2015 06:13:53 +0000 (23:13 -0700)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 3 Nov 2015 14:44:54 +0000 (15:44 +0100)
(cherry picked from commit c901a34c92c4aa74028f541a9773df726ce2b769)

 Conflicts:
deflate.c

deflate.c
gzwrite.c

index 65a9163a8aceb7846de83bc76f628b1e5cc1513b..ec770ff72b057a9f12b40611ca1ca1ad5d868afc 100644 (file)
--- 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);
     }
index 58b5897970eb8ef66c9921687cce1a5d4cef78ae..8c8078177af7d501758e170f2fad35aec296ed80 100644 (file)
--- 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 */