Fix crash when gzsetparams() attempted for transparent write.

gzsetparams() now returns a Z_STREAM_ERROR in this case.
This commit is contained in:
Mark Adler 2022-12-26 23:36:01 -08:00
parent e554695638
commit 02a6049eb3

View File

@ -609,7 +609,7 @@ int ZEXPORT gzsetparams(file, level, 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 */