From b516b4bdd7c0c9f0858adfebf732089014f7b282 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Mon, 24 Oct 2016 20:11:41 -0700 Subject: Do a more thorough check of the state for every stream call. This verifies that the state has been initialized, that it is the expected type of state, deflate or inflate, and that at least the first several bytes of the internal state have not been clobbered. --- inflate.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inflate.h') diff --git a/inflate.h b/inflate.h index ed434e5..047124d 100644 --- a/inflate.h +++ b/inflate.h @@ -18,7 +18,7 @@ /* Possible inflate modes between inflate() calls */ typedef enum { - HEAD, /* i: waiting for magic header */ + HEAD = 16180, /* i: waiting for magic header */ FLAGS, /* i: waiting for method and flags (gzip) */ TIME, /* i: waiting for modification time (gzip) */ OS, /* i: waiting for extra flags and operating system (gzip) */ @@ -80,6 +80,7 @@ typedef enum { /* State maintained between inflate() calls -- approximately 7K bytes, not including the allocated sliding window, which is up to 32K bytes. */ struct inflate_state { + z_streamp strm; /* pointer back to this zlib stream */ inflate_mode mode; /* current inflate mode */ int last; /* true if processing last block */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip, -- cgit v1.2.3-55-g6feb