$NetBSD: patch-ab,v 1.3 2013/06/11 08:28:30 adam Exp $ --- unpack.c.orig 2013-02-02 04:39:13.000000000 +0000 +++ unpack.c @@ -21,7 +21,6 @@ #include "tailor.h" #include "gzip.h" -#define MIN(a,b) ((a) <= (b) ? (a) : (b)) /* The arguments must not have side effects. */ #define MAX_BITLEN 25 @@ -157,7 +156,7 @@ local void read_tree() /* Remember where the literals of this length start in literal[] : */ lit_base[len] = base; /* And read the literals: */ - for (n = leaves[len]; n > 0; n--) { + for (n = leaves[len]; n > 0 && base < LITERALS; n--) { literal[base++] = read_byte (); } } @@ -193,7 +192,7 @@ local void build_tree() prefixp = &prefix_len[1< prefix_len) *--prefixp = (uch)len; } /* The length of all other codes is unknown: */ while (prefixp > prefix_len) *--prefixp = 0;