* inflate.c (huft_build): Fix regression that caused gzip to
[debian/gzip] / inflate.c
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;
   }