From: Mark Adler Date: Tue, 27 Dec 2022 07:36:01 +0000 (-0800) Subject: Fix crash when gzsetparams() attempted for transparent write. X-Git-Tag: 2.1.0-beta1~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e713f2f460a1b7fcf617ae837bc95b68abb3803b;p=thirdparty%2Fzlib-ng.git Fix crash when gzsetparams() attempted for transparent write. gzsetparams() now returns a Z_STREAM_ERROR in this case. --- diff --git a/gzwrite.c b/gzwrite.c index ba716bc20..08e0ce9aa 100644 --- a/gzwrite.c +++ b/gzwrite.c @@ -460,7 +460,7 @@ int Z_EXPORT PREFIX(gzsetparams)(gzFile file, int level, int strategy) { strm = &(state->strm); /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) + if (state->mode != GZ_WRITE || state->err != Z_OK || state->direct) return Z_STREAM_ERROR; /* if no change is requested, then do nothing */