From 1944b2cc36c196adc4ce313d1bd6a9aae5d90024 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 13 Feb 2007 19:23:47 +0000 Subject: [PATCH] When building the static Huffman tables, it's vital to include the two unused entries at the end of the lit/len table (286 and 287), because without them all the 9-bit codes are off by four. I can only assume I hadn't noticed this before because no test file I've compressed had both (a) contained byte values >= 0x90 and (b) required a static block. git-svn-id: svn://svn.tartarus.org/sgt/halibut@7279 cda61777-01e9-0310-a592-d414129be87e --- deflate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deflate.c b/deflate.c index 685097b..8749397 100644 --- a/deflate.c +++ b/deflate.c @@ -651,8 +651,8 @@ struct deflate_compress_ctx { unsigned long datasize; int lastblock; int finished; - unsigned char static_len1[286], static_len2[30]; - int static_code1[286], static_code2[30]; + unsigned char static_len1[288], static_len2[30]; + int static_code1[288], static_code2[30]; struct huftrees sht; #ifdef STATISTICS unsigned long bitcount; -- 2.11.0