Skip to content

Commit 4aad724

Browse files
Tim YaminLinus Torvalds
authored andcommitted
[PATCH] Update in-kernel zlib routines
These bugs have been fixed in the standard zlib for a while. See for example a) http://sources.redhat.com/ml/bug-gnu-utils/1999-06/msg00183.html b) http://bugs.gentoo.org/show_bug.cgi?id=94584 Signed-off-by: Tim Yamin <plasmaroo@gentoo.org> Signed-off-by: Tavis Ormandy <taviso@gentoo.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 00a5dfd commit 4aad724

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

‎arch/ppc64/boot/zlib.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ local int huft_build(
13071307
{
13081308
*t = (inflate_huft *)Z_NULL;
13091309
*m = 0;
1310-
return Z_OK;
1310+
return Z_DATA_ERROR;
13111311
}
13121312

13131313

@@ -1351,6 +1351,7 @@ local int huft_build(
13511351
if ((j = *p++) != 0)
13521352
v[x[j]++] = i;
13531353
} while (++i < n);
1354+
n = x[g]; /* set n to length of v */
13541355

13551356

13561357
/* Generate the Huffman codes and for each, make the table entries */

‎lib/inflate.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ DEBG("huft1 ");
326326
{
327327
*t = (struct huft *)NULL;
328328
*m = 0;
329-
return 0;
329+
return 2;
330330
}
331331

332332
DEBG("huft2 ");
@@ -374,6 +374,7 @@ DEBG("huft5 ");
374374
if ((j = *p++) != 0)
375375
v[x[j]++] = i;
376376
} while (++i < n);
377+
n = x[g]; /* set n to length of v */
377378

378379
DEBG("h6 ");
379380

@@ -410,12 +411,13 @@ DEBG1("1 ");
410411
DEBG1("2 ");
411412
f -= a + 1; /* deduct codes from patterns left */
412413
xp = c + k;
413-
while (++j < z) /* try smaller tables up to z bits */
414-
{
415-
if ((f <<= 1) <= *++xp)
416-
break; /* enough codes to use up j bits */
417-
f -= *xp; /* else deduct codes from patterns */
418-
}
414+
if (j < z)
415+
while (++j < z) /* try smaller tables up to z bits */
416+
{
417+
if ((f <<= 1) <= *++xp)
418+
break; /* enough codes to use up j bits */
419+
f -= *xp; /* else deduct codes from patterns */
420+
}
419421
}
420422
DEBG1("3 ");
421423
z = 1 << j; /* table entries for j-bit table */

‎lib/zlib_inflate/inftrees.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static int huft_build(
141141
{
142142
*t = NULL;
143143
*m = 0;
144-
return Z_OK;
144+
return Z_DATA_ERROR;
145145
}
146146

147147

0 commit comments

Comments
 (0)