summaryrefslogtreecommitdiff
path: root/infback.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:26:40 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:26:40 -0700
commitf6194ef39af5864f792412460c354cc339dde7d1 (patch)
tree5ea1e6849128e9b2194c66ee3d82afa36b4ac07c /infback.c
parent639be997883d9016baaf46017a2802b2ce1698bd (diff)
downloadzlib-f6194ef39af5864f792412460c354cc339dde7d1.tar.gz
zlib 1.2.3.4v1.2.3.4
Diffstat (limited to 'infback.c')
-rw-r--r--infback.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/infback.c b/infback.c
index be0b3dc..e279d8f 100644
--- a/infback.c
+++ b/infback.c
@@ -1,5 +1,5 @@
/* infback.c -- inflate using a call-back interface
- * Copyright (C) 1995-2006 Mark Adler
+ * Copyright (C) 1995-2008 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -438,7 +438,16 @@ void FAR *out_desc;
/* handle error breaks in while */
if (state->mode == BAD) break;
- /* build code tables */
+ /* check for end-of-block code (better have one) */
+ if (state->lens[256] == 0) {
+ strm->msg = (char *)"invalid code -- missing end-of-block";
+ state->mode = BAD;
+ break;
+ }
+
+ /* build code tables -- note: do not change the lenbits or distbits
+ values here (9 and 6) without reading the comments in inftrees.h
+ concerning the ENOUGH constants, which depend on those values */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lenbits = 9;