* inflate.c (huft_build): Fix regression that caused gzip to
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Dec 2006 23:30:17 +0000 (23:30 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Dec 2006 23:30:17 +0000 (23:30 +0000)
refuse to uncompress null input (all zero length codes).  Problem
reported by Yiorgos Adamopoulos.  This regression was caused by
the security patch installed 2006-11-20, which in turn came from
Debian, which in turn apparently came from Thomas Biege of SuSe.

ChangeLog
inflate.c

index bd6e350c535a3ed0b9b31b1de115847650b330a3..9649dfcefcb1436121617b0e88ba1480159755f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-12-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * inflate.c (huft_build): Fix regression that caused gzip to
+       refuse to uncompress null input (all zero length codes).  Problem
+       reported by Yiorgos Adamopoulos.  This regression was caused by
+       the security patch installed 2006-11-20, which in turn came from
+       Debian, which in turn apparently came from Thomas Biege of SuSe.
+
 2006-12-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        * NEWS, configure.ac (AC_INIT):
index e5aa0d812709452b9a73857a9ff105f31287cffe..efca2bf765b56875ea65760ba6ebb76fac963c40 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -335,9 +335,16 @@ int *m;                 /* maximum lookup bits, returns actual */
   } while (--i);
   if (c[0] == n)                /* null input--all zero length codes */
   {
-    *t = (struct huft *)NULL;
-    *m = 0;
-    return 2;
+    q = (struct huft *) malloc (2 * sizeof *q);
+    if (!q)
+      return 3;
+    hufts += 2;
+    q[0].v.t = (struct huft *) NULL;
+    q[1].e = 99;    /* invalid code marker */
+    q[1].b = 1;
+    *t = q + 1;
+    *m = 1;
+    return 0;
   }