]> git.lizzy.rs Git - zlib.git/blobdiff - inflate.c
Avoid the use of ptrdiff_t.
[zlib.git] / inflate.c
index ac333e8c2edae90ec1145d06d9852002dd5d0617..575fcdf82ad1060679ab144dc66b33a89d9001ef 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -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;
@@ -1531,7 +1533,7 @@ int check;
 
     if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
     state = (struct inflate_state FAR *)strm->state;
-    if (check)
+    if (check && state->wrap)
         state->wrap |= 4;
     else
         state->wrap &= ~4;