Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Handle case where inflateSync used when header never processed.
Browse files Browse the repository at this point in the history
If zlib and/or gzip header processing was requested, but a header
was never provided and inflateSync was used successfully, then the
inflate state would be inconsistent, trying to compute a check
value but with no flags set. This commit sets the inflate mode to
raw in this case, since there is no other assumption that can be
made if a header was requested but never seen.
  • Loading branch information
madler committed Apr 16, 2017
1 parent 89245c0 commit 44e8ac8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,8 @@ z_streamp strm;

/* return no joy or set up to restart inflate() on a new block */
if (state->have != 4) return Z_DATA_ERROR;
if (state->mode == HEAD)
state->wrap = 0; /* never processed header, so assume raw */
in = strm->total_in; out = strm->total_out;
inflateReset(strm);
strm->total_in = in; strm->total_out = out;
Expand Down

0 comments on commit 44e8ac8

Please sign in to comment.