@ -1461,7 +1461,7 @@ elf_zlib_inflate_table (unsigned char *codes, size_t codes_len,
@@ -1461,7 +1461,7 @@ elf_zlib_inflate_table (unsigned char *codes, size_t codes_len,
# include <stdio.h>
static uint16_t table [ ZDEBUG_TABLE_SIZE ] ;
static unsigned char codes [ 287 ] ;
static unsigned char codes [ 288 ] ;
int
main ( )
@ -1476,7 +1476,7 @@ main ()
@@ -1476,7 +1476,7 @@ main ()
codes [ i ] = 7 ;
for ( i = 280 ; i < = 287 ; + + i )
codes [ i ] = 8 ;
if ( ! elf_zlib_inflate_table ( & codes [ 0 ] , 287 , & table [ 0 ] , & table [ 0 ] ) )
if ( ! elf_zlib_inflate_table ( & codes [ 0 ] , 288 , & table [ 0 ] , & table [ 0 ] ) )
{
fprintf ( stderr , " elf_zlib_inflate_table failed \n " ) ;
exit ( EXIT_FAILURE ) ;
@ -1495,48 +1495,72 @@ main ()
@@ -1495,48 +1495,72 @@ main ()
printf ( " \n " ) ;
}
printf ( " }; \n " ) ;
printf ( " \n " ) ;
for ( i = 0 ; i < 32 ; + + i )
codes [ i ] = 5 ;
if ( ! elf_zlib_inflate_table ( & codes [ 0 ] , 32 , & table [ 0 ] , & table [ 0 ] ) )
{
fprintf ( stderr , " elf_zlib_inflate_table failed \n " ) ;
exit ( EXIT_FAILURE ) ;
}
printf ( " static const uint16_t elf_zlib_default_dist_table[%#zx] = \n " ,
final_next_secondary + 0x100 ) ;
printf ( " { \n " ) ;
for ( i = 0 ; i < final_next_secondary + 0x100 ; i + = 8 )
{
size_t j ;
printf ( " " ) ;
for ( j = i ; j < final_next_secondary + 0x100 & & j < i + 8 ; + + j )
printf ( " %#x, " , table [ j ] ) ;
printf ( " \n " ) ;
}
printf ( " }; \n " ) ;
return 0 ;
}
# endif
/* The fixed table generated by the #ifdef'ed out main function
/* The fixed tables generated by the #ifdef'ed out main function
above . */
static const uint16_t elf_zlib_default_table [ 0x170 ] =
{
0xd00 , 0xe50 , 0xe10 , 0xf18 , 0xd10 , 0xe70 , 0xe30 , 0x1232 ,
0xd08 , 0xe60 , 0xe20 , 0x1212 , 0xe00 , 0xe80 , 0xe40 , 0x1252 ,
0xd04 , 0xe58 , 0xe18 , 0x1202 , 0xd14 , 0xe78 , 0xe38 , 0x1242 ,
0xd0c , 0xe68 , 0xe28 , 0x1222 , 0xe08 , 0xe88 , 0xe48 , 0x1262 ,
0xd02 , 0xe54 , 0xe14 , 0xf1c , 0xd12 , 0xe74 , 0xe34 , 0x123a ,
0xd0a , 0xe64 , 0xe24 , 0x121a , 0xe04 , 0xe84 , 0xe44 , 0x125a ,
0xd06 , 0xe5c , 0xe1c , 0x120a , 0xd16 , 0xe7c , 0xe3c , 0x124a ,
0xd0e , 0xe6c , 0xe2c , 0x122a , 0xe0c , 0xe8c , 0xe4c , 0x126a ,
0xd01 , 0xe52 , 0xe12 , 0xf1a , 0xd11 , 0xe72 , 0xe32 , 0x1236 ,
0xd09 , 0xe62 , 0xe22 , 0x1216 , 0xe02 , 0xe82 , 0xe42 , 0x1256 ,
0xd05 , 0xe5a , 0xe1a , 0x1206 , 0xd15 , 0xe7a , 0xe3a , 0x1246 ,
0xd0d , 0xe6a , 0xe2a , 0x1226 , 0xe0a , 0xe8a , 0xe4a , 0x1266 ,
0xd03 , 0xe56 , 0xe16 , 0xf1e , 0xd13 , 0xe76 , 0xe36 , 0x123e ,
0xd0b , 0xe66 , 0xe26 , 0x121e , 0xe06 , 0xe86 , 0xe46 , 0x125e ,
0xd07 , 0xe5e , 0xe1e , 0x120e , 0xd17 , 0xe7e , 0xe3e , 0x124e ,
0xd0f , 0xe6e , 0xe2e , 0x122e , 0xe0e , 0xe8e , 0xe4e , 0x126e ,
0xd00 , 0xe51 , 0xe11 , 0xf19 , 0xd10 , 0xe71 , 0xe31 , 0x1234 ,
0xd08 , 0xe61 , 0xe21 , 0x1214 , 0xe01 , 0xe81 , 0xe41 , 0x1254 ,
0xd04 , 0xe59 , 0xe19 , 0x1204 , 0xd14 , 0xe79 , 0xe39 , 0x1244 ,
0xd0c , 0xe69 , 0xe29 , 0x1224 , 0xe09 , 0xe89 , 0xe49 , 0x1264 ,
0xd02 , 0xe55 , 0xe15 , 0xf1d , 0xd12 , 0xe75 , 0xe35 , 0x123c ,
0xd0a , 0xe65 , 0xe25 , 0x121c , 0xe05 , 0xe85 , 0xe45 , 0x125c ,
0xd06 , 0xe5d , 0xe1d , 0x120c , 0xd16 , 0xe7d , 0xe3d , 0x124c ,
0xd0e , 0xe6d , 0xe2d , 0x122c , 0xe0d , 0xe8d , 0xe4d , 0x126c ,
0xd01 , 0xe53 , 0xe13 , 0xf1b , 0xd11 , 0xe73 , 0xe33 , 0x1238 ,
0xd09 , 0xe63 , 0xe23 , 0x1218 , 0xe03 , 0xe83 , 0xe43 , 0x1258 ,
0xd05 , 0xe5b , 0xe1b , 0x1208 , 0xd15 , 0xe7b , 0xe3b , 0x1248 ,
0xd0d , 0xe6b , 0xe2b , 0x1228 , 0xe0b , 0xe8b , 0xe4b , 0x1268 ,
0xd03 , 0xe57 , 0xe17 , 0x1200 , 0xd13 , 0xe77 , 0xe37 , 0x1240 ,
0xd0b , 0xe67 , 0xe27 , 0x1220 , 0xe07 , 0xe87 , 0xe47 , 0x1260 ,
0xd07 , 0xe5f , 0xe1f , 0x121 0 , 0xd17 , 0xe7f , 0xe3f , 0x1250 ,
0xd0f , 0xe6f , 0xe2f , 0x1230 , 0xe0f , 0xe8f , 0xe4f , 0 ,
0xd00 , 0xe50 , 0xe10 , 0xf18 , 0xd10 , 0xe70 , 0xe30 , 0x1230 ,
0xd08 , 0xe60 , 0xe20 , 0x1210 , 0xe00 , 0xe80 , 0xe40 , 0x1250 ,
0xd04 , 0xe58 , 0xe18 , 0x1200 , 0xd14 , 0xe78 , 0xe38 , 0x1240 ,
0xd0c , 0xe68 , 0xe28 , 0x1220 , 0xe08 , 0xe88 , 0xe48 , 0x1260 ,
0xd02 , 0xe54 , 0xe14 , 0xf1c , 0xd12 , 0xe74 , 0xe34 , 0x1238 ,
0xd0a , 0xe64 , 0xe24 , 0x1218 , 0xe04 , 0xe84 , 0xe44 , 0x1258 ,
0xd06 , 0xe5c , 0xe1c , 0x1208 , 0xd16 , 0xe7c , 0xe3c , 0x1248 ,
0xd0e , 0xe6c , 0xe2c , 0x1228 , 0xe0c , 0xe8c , 0xe4c , 0x1268 ,
0xd01 , 0xe52 , 0xe12 , 0xf1a , 0xd11 , 0xe72 , 0xe32 , 0x1234 ,
0xd09 , 0xe62 , 0xe22 , 0x1214 , 0xe02 , 0xe82 , 0xe42 , 0x1254 ,
0xd05 , 0xe5a , 0xe1a , 0x1204 , 0xd15 , 0xe7a , 0xe3a , 0x1244 ,
0xd0d , 0xe6a , 0xe2a , 0x1224 , 0xe0a , 0xe8a , 0xe4a , 0x1264 ,
0xd03 , 0xe56 , 0xe16 , 0xf1e , 0xd13 , 0xe76 , 0xe36 , 0x123c ,
0xd0b , 0xe66 , 0xe26 , 0x121c , 0xe06 , 0xe86 , 0xe46 , 0x125c ,
0xd07 , 0xe5e , 0xe1e , 0x120c , 0xd17 , 0xe7e , 0xe3e , 0x124c ,
0xd0f , 0xe6e , 0xe2e , 0x122c , 0xe0e , 0xe8e , 0xe4e , 0x126c ,
0xd00 , 0xe51 , 0xe11 , 0xf19 , 0xd10 , 0xe71 , 0xe31 , 0x1232 ,
0xd08 , 0xe61 , 0xe21 , 0x1212 , 0xe01 , 0xe81 , 0xe41 , 0x1252 ,
0xd04 , 0xe59 , 0xe19 , 0x1202 , 0xd14 , 0xe79 , 0xe39 , 0x1242 ,
0xd0c , 0xe69 , 0xe29 , 0x1222 , 0xe09 , 0xe89 , 0xe49 , 0x1262 ,
0xd02 , 0xe55 , 0xe15 , 0xf1d , 0xd12 , 0xe75 , 0xe35 , 0x123a ,
0xd0a , 0xe65 , 0xe25 , 0x121a , 0xe05 , 0xe85 , 0xe45 , 0x125a ,
0xd06 , 0xe5d , 0xe1d , 0x120a , 0xd16 , 0xe7d , 0xe3d , 0x124a ,
0xd0e , 0xe6d , 0xe2d , 0x122a , 0xe0d , 0xe8d , 0xe4d , 0x126a ,
0xd01 , 0xe53 , 0xe13 , 0xf1b , 0xd11 , 0xe73 , 0xe33 , 0x1236 ,
0xd09 , 0xe63 , 0xe23 , 0x1216 , 0xe03 , 0xe83 , 0xe43 , 0x1256 ,
0xd05 , 0xe5b , 0xe1b , 0x1206 , 0xd15 , 0xe7b , 0xe3b , 0x1246 ,
0xd0d , 0xe6b , 0xe2b , 0x1226 , 0xe0b , 0xe8b , 0xe4b , 0x1266 ,
0xd03 , 0xe57 , 0xe17 , 0xf1f , 0xd13 , 0xe77 , 0xe37 , 0x123e ,
0xd0b , 0xe67 , 0xe27 , 0x121e , 0xe07 , 0xe87 , 0xe47 , 0x125e ,
0xd07 , 0xe5f , 0xe1f , 0x120e , 0xd17 , 0xe7f , 0xe3f , 0x124e ,
0xd0f , 0xe6f , 0xe2f , 0x122e , 0xe0f , 0xe8f , 0xe4f , 0x126e ,
0x290 , 0x291 , 0x292 , 0x293 , 0x294 , 0x295 , 0x296 , 0x297 ,
0x298 , 0x299 , 0x29a , 0x29b , 0x29c , 0x29d , 0x29e , 0x29f ,
0x2a0 , 0x2a1 , 0x2a2 , 0x2a3 , 0x2a4 , 0x2a5 , 0x2a6 , 0x2a7 ,
@ -1553,6 +1577,42 @@ static const uint16_t elf_zlib_default_table[0x170] =
@@ -1553,6 +1577,42 @@ static const uint16_t elf_zlib_default_table[0x170] =
0x2f8 , 0x2f9 , 0x2fa , 0x2fb , 0x2fc , 0x2fd , 0x2fe , 0x2ff ,
} ;
static const uint16_t elf_zlib_default_dist_table [ 0x100 ] =
{
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
0x800 , 0x810 , 0x808 , 0x818 , 0x804 , 0x814 , 0x80c , 0x81c ,
0x802 , 0x812 , 0x80a , 0x81a , 0x806 , 0x816 , 0x80e , 0x81e ,
0x801 , 0x811 , 0x809 , 0x819 , 0x805 , 0x815 , 0x80d , 0x81d ,
0x803 , 0x813 , 0x80b , 0x81b , 0x807 , 0x817 , 0x80f , 0x81f ,
} ;
/* Inflate a zlib stream from PIN/SIN to POUT/SOUT. Return 1 on
success , 0 on some error parsing the stream . */
@ -1701,7 +1761,7 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table,
@@ -1701,7 +1761,7 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table,
if ( type = = 1 )
{
tlit = elf_zlib_default_table ;
tdist = elf_zlib_default_table ;
tdist = elf_zlib_default_dist_ table ;
}
else
{