cvs commit: patches/zlib zlib-1.2.1-inflate-fix-1.patch

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Sat Mar 13 12:16:06 PST 2004


tushar      04/03/13 13:16:06

  Added:       zlib     zlib-1.2.1-inflate-fix-1.patch
  Log:
  Added: zlib-1.2.1-inflate-fix-1.patch
  
  Revision  Changes    Path
  1.1                  patches/zlib/zlib-1.2.1-inflate-fix-1.patch
  
  Index: zlib-1.2.1-inflate-fix-1.patch
  ===================================================================
  Submitted By: Zack Winkles <winkie at linuxfromscratch.org>
  Date: 2004-03-13
  Initial Package Version: 1.2.1
  Upstream Status: Merged
  Origin: http://xenon.nocdirect.com/pipermail/zlib-devel_madler.net/2004-January/000409.html
  Description:
  
  A zip file was found that zlib 1.2.1 could not properly inflate, but 
  previous versions could (as well as various other versions of my 
  inflate code).  Oops.
  
  diff -Naur zlib-1.2.1/inftrees.c zlib-1.2.1.1/inftrees.c
  --- zlib-1.2.1/inftrees.c	2003-11-08 21:38:38.000000000 -0500
  +++ zlib-1.2.1.1/inftrees.c	2004-01-09 06:11:20.000000000 -0500
  @@ -62,7 +62,7 @@
           35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
       static const unsigned short lext[31] = { /* Length codes 257..285 extra */
           16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
  -        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 66};
  +        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 202, 196};
       static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
           1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
           257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
  @@ -114,7 +114,15 @@
       for (max = MAXBITS; max >= 1; max--)
           if (count[max] != 0) break;
       if (root > max) root = max;
  -    if (max == 0) return -1;            /* no codes! */
  +    if (max == 0) {                     /* no symbols to code at all */
  +        this.op = (unsigned char)64;    /* invalid code marker */
  +        this.bits = (unsigned char)1;
  +        this.val = (unsigned short)0;
  +        *(*table)++ = this;             /* make a table to force an error */
  +        *(*table)++ = this;
  +        *bits = 1;
  +        return 0;     /* no symbols, but wait for decoding to report error */
  +    }
       for (min = 1; min <= MAXBITS; min++)
           if (count[min] != 0) break;
       if (root < min) root = min;
  
  
  



More information about the patches mailing list