[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>

authored by Tim Yamin and committed by Linus Torvalds 4aad724d 00a5dfdb

+12 -9
+2 -1
arch/ppc64/boot/zlib.c
··· 1307 { 1308 *t = (inflate_huft *)Z_NULL; 1309 *m = 0; 1310 - return Z_OK; 1311 } 1312 1313 ··· 1351 if ((j = *p++) != 0) 1352 v[x[j]++] = i; 1353 } while (++i < n); 1354 1355 1356 /* Generate the Huffman codes and for each, make the table entries */
··· 1307 { 1308 *t = (inflate_huft *)Z_NULL; 1309 *m = 0; 1310 + return Z_DATA_ERROR; 1311 } 1312 1313 ··· 1351 if ((j = *p++) != 0) 1352 v[x[j]++] = i; 1353 } while (++i < n); 1354 + n = x[g]; /* set n to length of v */ 1355 1356 1357 /* Generate the Huffman codes and for each, make the table entries */
+9 -7
lib/inflate.c
··· 326 { 327 *t = (struct huft *)NULL; 328 *m = 0; 329 - return 0; 330 } 331 332 DEBG("huft2 "); ··· 374 if ((j = *p++) != 0) 375 v[x[j]++] = i; 376 } while (++i < n); 377 378 DEBG("h6 "); 379 ··· 411 DEBG1("2 "); 412 f -= a + 1; /* deduct codes from patterns left */ 413 xp = c + k; 414 - while (++j < z) /* try smaller tables up to z bits */ 415 - { 416 - if ((f <<= 1) <= *++xp) 417 - break; /* enough codes to use up j bits */ 418 - f -= *xp; /* else deduct codes from patterns */ 419 - } 420 } 421 DEBG1("3 "); 422 z = 1 << j; /* table entries for j-bit table */
··· 326 { 327 *t = (struct huft *)NULL; 328 *m = 0; 329 + return 2; 330 } 331 332 DEBG("huft2 "); ··· 374 if ((j = *p++) != 0) 375 v[x[j]++] = i; 376 } while (++i < n); 377 + n = x[g]; /* set n to length of v */ 378 379 DEBG("h6 "); 380 ··· 410 DEBG1("2 "); 411 f -= a + 1; /* deduct codes from patterns left */ 412 xp = c + k; 413 + if (j < z) 414 + while (++j < z) /* try smaller tables up to z bits */ 415 + { 416 + if ((f <<= 1) <= *++xp) 417 + break; /* enough codes to use up j bits */ 418 + f -= *xp; /* else deduct codes from patterns */ 419 + } 420 } 421 DEBG1("3 "); 422 z = 1 << j; /* table entries for j-bit table */
+1 -1
lib/zlib_inflate/inftrees.c
··· 141 { 142 *t = NULL; 143 *m = 0; 144 - return Z_OK; 145 } 146 147
··· 141 { 142 *t = NULL; 143 *m = 0; 144 + return Z_DATA_ERROR; 145 } 146 147