]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix crash when gzsetparams() attempted for transparent write.
authorMark Adler <madler@alumni.caltech.edu>
Tue, 27 Dec 2022 07:36:01 +0000 (23:36 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 17 Mar 2023 20:27:56 +0000 (21:27 +0100)
gzsetparams() now returns a Z_STREAM_ERROR in this case.

gzwrite.c

index c4e178f9ad6272f74dec911b0b88b983465079e3..a98ee306c7ad441b736c51b235dc9598b7231b9f 100644 (file)
--- 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 */