]> git.lizzy.rs Git - zlib.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)
committerMark Adler <madler@alumni.caltech.edu>
Wed, 29 Jul 2015 06:13:53 +0000 (23:13 -0700)
deflate.c
gzwrite.c

index 7a9e05e5e6789037e0cced91d5e03f468d765289..544521ddc6fb559f4cb4ff4c91a13ea28f2a53c7 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -676,7 +676,7 @@ int ZEXPORT deflate (strm, flush)
     s = strm->state;
 
     if (strm->next_out == Z_NULL ||
-        (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+        (strm->avail_in != 0 && strm->next_in == Z_NULL) ||
         (s->status == FINISH_STATE && flush != Z_FINISH)) {
         ERR_RETURN(strm, Z_STREAM_ERROR);
     }
index ad164b2ece9e367eb2fcbcf6dcf89fb0ffa92591..efff93af013c756fd22808e171ce412d18606a36 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -47,6 +47,7 @@ local int gz_init(state)
             gz_error(state, Z_MEM_ERROR, "out of memory");
             return -1;
         }
+        strm->next_in = NULL;
     }
 
     /* mark state as initialized */