summaryrefslogtreecommitdiff
path: root/lib/libz
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-07-06 14:53:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-07-06 14:53:45 +0000
commita3449e523b774a59543e2e1f24254899f743775a (patch)
tree330c73cfe81b4a884182fe21fe37a2f7c8184fa7 /lib/libz
parent6f23ee77df223bf8150be11d42a0a4b0c3247eb5 (diff)
Fix bounds check for incomplete code sets so they cannot overflow the codes
array. From Mark Adler.
Diffstat (limited to 'lib/libz')
-rw-r--r--lib/libz/inftrees.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libz/inftrees.c b/lib/libz/inftrees.c
index 555ee574b5c..5149610e545 100644
--- a/lib/libz/inftrees.c
+++ b/lib/libz/inftrees.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inftrees.c,v 1.6 2004/12/03 03:06:36 djm Exp $ */
+/* $OpenBSD: inftrees.c,v 1.7 2005/07/06 14:53:44 millert Exp $ */
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2004 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -135,7 +135,7 @@ unsigned short FAR *work;
left -= count[len];
if (left < 0) return -1; /* over-subscribed */
}
- if (left > 0 && (type == CODES || (codes - count[0] != 1)))
+ if (left > 0 && (type == CODES || max != 1))
return -1; /* incomplete set */
/* generate offsets into symbol table for each length for sorting */