backport fix from gzip 1.3.5

This commit is contained in:
Laurent Vivier 2005-06-06 18:15:51 +00:00
parent 4e40550c9f
commit a7486773fc

View File

@ -368,6 +368,7 @@ DEBG("huft5 ");
if ((j = *p++) != 0)
v[x[j]++] = i;
} while (++i < n);
n = x[g]; /* set n to length of v */
DEBG("h6 ");
@ -404,12 +405,13 @@ DEBG1("1 ");
DEBG1("2 ");
f -= a + 1; /* deduct codes from patterns left */
xp = c + k;
while (++j < z) /* try smaller tables up to z bits */
{
if ((f <<= 1) <= *++xp)
break; /* enough codes to use up j bits */
f -= *xp; /* else deduct codes from patterns */
}
if (j < z)
while (++j < z) /* try smaller tables up to z bits */
{
if ((f <<= 1) <= *++xp)
break; /* enough codes to use up j bits */
f -= *xp; /* else deduct codes from patterns */
}
}
DEBG1("3 ");
z = 1 << j; /* table entries for j-bit table */
@ -799,6 +801,8 @@ DEBG("dyn2 ");
return i; /* incomplete code set */
}
if (tl == NULL) /* Grrrhhh */
return 2;
DEBG("dyn3 ");
/* read in literal and distance code lengths */