diff options
Diffstat (limited to 'archivers/gzip/patches/patch-ab')
-rw-r--r-- | archivers/gzip/patches/patch-ab | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/archivers/gzip/patches/patch-ab b/archivers/gzip/patches/patch-ab new file mode 100644 index 00000000000..b3329e01611 --- /dev/null +++ b/archivers/gzip/patches/patch-ab @@ -0,0 +1,30 @@ +$NetBSD: patch-ab,v 1.1 2007/11/08 19:26:53 joerg Exp $ + +--- unpack.c.orig 1993-08-13 08:35:00.000000000 +0100 ++++ unpack.c +@@ -12,7 +12,6 @@ static char rcsid[] = "$Id: unpack.c,v 1 + #include "gzip.h" + #include "crypt.h" + +-#define MIN(a,b) ((a) <= (b) ? (a) : (b)) + /* The arguments must not have side effects. */ + + #define MAX_BITLEN 25 +@@ -132,7 +131,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++] = (uch)get_byte(); + } + } +@@ -168,7 +167,7 @@ local void build_tree() + prefixp = &prefix_len[1<<peek_bits]; + for (len = 1; len <= peek_bits; len++) { + int prefixes = leaves[len] << (peek_bits-len); /* may be 0 */ +- while (prefixes--) *--prefixp = (uch)len; ++ while (prefixes-- && prefixp > prefix_len) *--prefixp = (uch)len; + } + /* The length of all other codes is unknown: */ + while (prefixp > prefix_len) *--prefixp = 0; |