Skip to content

Commit

Permalink
Fix crash when gzsetparams() attempted for transparent write.
Browse files Browse the repository at this point in the history
gzsetparams() now returns a Z_STREAM_ERROR in this case.
  • Loading branch information
madler authored and Dead2 committed Feb 3, 2023
1 parent 4af454b commit e713f2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gzwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e713f2f

Please sign in to comment.