|
Line
Link Here
|
|
[PATCH] Update in-kernel zlib routines |
|
[PATCH] Update in-kernel zlib routines |
| 1 |
|
1 |
|
| 2 |
These bugs have been fixed in the standard zlib for a while. |
2 |
These bugs have been fixed in the standard zlib for a while. |
| 3 |
|
3 |
|
| 4 |
See for example |
4 |
See for example |
| 5 |
|
5 |
|
| 6 |
a) http://sources.redhat.com/ml/bug-gnu-utils/1999-06/msg00183.html |
6 |
a) http://sources.redhat.com/ml/bug-gnu-utils/1999-06/msg00183.html |
| 7 |
b) http://bugs.gentoo.org/show_bug.cgi?id=94584 |
7 |
b) http://bugs.gentoo.org/show_bug.cgi?id=94584 |
| 8 |
|
8 |
|
| 9 |
Signed-off-by: Tim Yamin <plasmaroo@gentoo.org> |
9 |
Signed-off-by: Tim Yamin <plasmaroo@gentoo.org> |
| 10 |
Signed-off-by: Tavis Ormandy <taviso@gentoo.org> |
10 |
Signed-off-by: Tavis Ormandy <taviso@gentoo.org> |
| 11 |
Signed-off-by: Linus Torvalds <torvalds@osdl.org> |
11 |
Signed-off-by: Linus Torvalds <torvalds@osdl.org> |
| 12 |
-- |
12 |
++ b/arch/ppc64/boot/zlib.c |
| 13 |
-- a/arch/ppc64/boot/zlib.c |
|
|
|
Lines 1307-1313
local int huft_build(
Link Here
|
| 1307 |
{ |
1307 |
{ |
| 1308 |
*t = (inflate_huft *)Z_NULL; |
1308 |
*t = (inflate_huft *)Z_NULL; |
| 1309 |
*m = 0; |
1309 |
*m = 0; |
| 1310 |
return Z_OK; |
1310 |
return Z_DATA_ERROR; |
| 1311 |
} |
1311 |
} |
| 1312 |
|
1312 |
|
| 1313 |
|
1313 |
|
|
Lines 1351-1356
local int huft_build(
Link Here
|
| 1351 |
if ((j = *p++) != 0) |
1351 |
if ((j = *p++) != 0) |
| 1352 |
v[x[j]++] = i; |
1352 |
v[x[j]++] = i; |
| 1353 |
} while (++i < n); |
1353 |
} while (++i < n); |
|
|
1354 |
n = x[g]; /* set n to length of v */ |
| 1354 |
|
1355 |
|
| 1355 |
|
1356 |
|
| 1356 |
/* Generate the Huffman codes and for each, make the table entries */ |
1357 |
/* Generate the Huffman codes and for each, make the table entries */ |
| 1357 |
-- a/lib/inflate.c |
1358 |
++ b/lib/inflate.c |
|
Lines 326-332
DEBG("huft1 ");
Link Here
|
| 326 |
{ |
326 |
{ |
| 327 |
*t = (struct huft *)NULL; |
327 |
*t = (struct huft *)NULL; |
| 328 |
*m = 0; |
328 |
*m = 0; |
| 329 |
return 0; |
329 |
return 2; |
| 330 |
} |
330 |
} |
| 331 |
|
331 |
|
| 332 |
DEBG("huft2 "); |
332 |
DEBG("huft2 "); |
|
Lines 374-379
DEBG("huft5 ");
Link Here
|
| 374 |
if ((j = *p++) != 0) |
374 |
if ((j = *p++) != 0) |
| 375 |
v[x[j]++] = i; |
375 |
v[x[j]++] = i; |
| 376 |
} while (++i < n); |
376 |
} while (++i < n); |
|
|
377 |
n = x[g]; /* set n to length of v */ |
| 377 |
|
378 |
|
| 378 |
DEBG("h6 "); |
379 |
DEBG("h6 "); |
| 379 |
|
380 |
|
|
Lines 410-421
DEBG1("1 ");
Link Here
|
| 410 |
DEBG1("2 "); |
411 |
DEBG1("2 "); |
| 411 |
f -= a + 1; /* deduct codes from patterns left */ |
412 |
f -= a + 1; /* deduct codes from patterns left */ |
| 412 |
xp = c + k; |
413 |
xp = c + k; |
| 413 |
while (++j < z) /* try smaller tables up to z bits */ |
414 |
if (j < z) |
| 414 |
{ |
415 |
while (++j < z) /* try smaller tables up to z bits */ |
| 415 |
if ((f <<= 1) <= *++xp) |
416 |
{ |
| 416 |
break; /* enough codes to use up j bits */ |
417 |
if ((f <<= 1) <= *++xp) |
| 417 |
f -= *xp; /* else deduct codes from patterns */ |
418 |
break; /* enough codes to use up j bits */ |
| 418 |
} |
419 |
f -= *xp; /* else deduct codes from patterns */ |
|
|
420 |
} |
| 419 |
} |
421 |
} |
| 420 |
DEBG1("3 "); |
422 |
DEBG1("3 "); |
| 421 |
z = 1 << j; /* table entries for j-bit table */ |
423 |
z = 1 << j; /* table entries for j-bit table */ |
| 422 |
-- a/lib/zlib_inflate/inftrees.c |
424 |
++ b/lib/zlib_inflate/inftrees.c |
|
Lines 141-147
static int huft_build(
Link Here
|
| 141 |
{ |
141 |
{ |
| 142 |
*t = NULL; |
142 |
*t = NULL; |
| 143 |
*m = 0; |
143 |
*m = 0; |
| 144 |
return Z_OK; |
144 |
return Z_DATA_ERROR; |
| 145 |
} |
145 |
} |
| 146 |
|
146 |
|
| 147 |
|
147 |
|