From c901a34c92c4aa74028f541a9773df726ce2b769 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Tue, 28 Jul 2015 23:13:53 -0700 Subject: [PATCH] Avoid uninitialized access by gzclose_w(). --- deflate.c | 2 +- gzwrite.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deflate.c b/deflate.c index 7a9e05e..544521d 100644 --- 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); } diff --git a/gzwrite.c b/gzwrite.c index ad164b2..efff93a 100644 --- 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 */