Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit f2c17c0

Browse files
libbacktrace: update to GCC SVN revision 256776
This brings in this patch: * elf.c (codes) [GENERATE_FIXED_HUFFMAN_TABLE]: Fix size to be 288. (main) [GENERATE_FIXED_HUFFMAN_TABLE]: Pass 288 to elf_zlib_inflate_table. Generate elf_zlib_default_dist_table. (elf_zlib_default_table): Update. (elf_zlib_default_dist_table): New static array. (elf_zlib_inflate): Use elf_zlib_default_dist_table for dist table for block type 1. * ztest.c (struct zlib_test): Add uncompressed_len. (tests): Initialize uncompressed_len field. Add new test case. (test_samples): Use uncompressed_len field.
1 parent 862169a commit f2c17c0

File tree

2 files changed

+160
-37
lines changed

2 files changed

+160
-37
lines changed

elf.c

Lines changed: 96 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ elf_zlib_inflate_table (unsigned char *codes, size_t codes_len,
14611461
#include <stdio.h>
14621462

14631463
static uint16_t table[ZDEBUG_TABLE_SIZE];
1464-
static unsigned char codes[287];
1464+
static unsigned char codes[288];
14651465

14661466
int
14671467
main ()
@@ -1476,7 +1476,7 @@ main ()
14761476
codes[i] = 7;
14771477
for (i = 280; i <= 287; ++i)
14781478
codes[i] = 8;
1479-
if (!elf_zlib_inflate_table (&codes[0], 287, &table[0], &table[0]))
1479+
if (!elf_zlib_inflate_table (&codes[0], 288, &table[0], &table[0]))
14801480
{
14811481
fprintf (stderr, "elf_zlib_inflate_table failed\n");
14821482
exit (EXIT_FAILURE);
@@ -1495,48 +1495,72 @@ main ()
14951495
printf ("\n");
14961496
}
14971497
printf ("};\n");
1498+
printf ("\n");
1499+
1500+
for (i = 0; i < 32; ++i)
1501+
codes[i] = 5;
1502+
if (!elf_zlib_inflate_table (&codes[0], 32, &table[0], &table[0]))
1503+
{
1504+
fprintf (stderr, "elf_zlib_inflate_table failed\n");
1505+
exit (EXIT_FAILURE);
1506+
}
1507+
1508+
printf ("static const uint16_t elf_zlib_default_dist_table[%#zx] =\n",
1509+
final_next_secondary + 0x100);
1510+
printf ("{\n");
1511+
for (i = 0; i < final_next_secondary + 0x100; i += 8)
1512+
{
1513+
size_t j;
1514+
1515+
printf (" ");
1516+
for (j = i; j < final_next_secondary + 0x100 && j < i + 8; ++j)
1517+
printf (" %#x,", table[j]);
1518+
printf ("\n");
1519+
}
1520+
printf ("};\n");
1521+
14981522
return 0;
14991523
}
15001524

15011525
#endif
15021526

1503-
/* The fixed table generated by the #ifdef'ed out main function
1527+
/* The fixed tables generated by the #ifdef'ed out main function
15041528
above. */
15051529

15061530
static const uint16_t elf_zlib_default_table[0x170] =
15071531
{
1508-
0xd00, 0xe50, 0xe10, 0xf18, 0xd10, 0xe70, 0xe30, 0x1232,
1509-
0xd08, 0xe60, 0xe20, 0x1212, 0xe00, 0xe80, 0xe40, 0x1252,
1510-
0xd04, 0xe58, 0xe18, 0x1202, 0xd14, 0xe78, 0xe38, 0x1242,
1511-
0xd0c, 0xe68, 0xe28, 0x1222, 0xe08, 0xe88, 0xe48, 0x1262,
1512-
0xd02, 0xe54, 0xe14, 0xf1c, 0xd12, 0xe74, 0xe34, 0x123a,
1513-
0xd0a, 0xe64, 0xe24, 0x121a, 0xe04, 0xe84, 0xe44, 0x125a,
1514-
0xd06, 0xe5c, 0xe1c, 0x120a, 0xd16, 0xe7c, 0xe3c, 0x124a,
1515-
0xd0e, 0xe6c, 0xe2c, 0x122a, 0xe0c, 0xe8c, 0xe4c, 0x126a,
1516-
0xd01, 0xe52, 0xe12, 0xf1a, 0xd11, 0xe72, 0xe32, 0x1236,
1517-
0xd09, 0xe62, 0xe22, 0x1216, 0xe02, 0xe82, 0xe42, 0x1256,
1518-
0xd05, 0xe5a, 0xe1a, 0x1206, 0xd15, 0xe7a, 0xe3a, 0x1246,
1519-
0xd0d, 0xe6a, 0xe2a, 0x1226, 0xe0a, 0xe8a, 0xe4a, 0x1266,
1520-
0xd03, 0xe56, 0xe16, 0xf1e, 0xd13, 0xe76, 0xe36, 0x123e,
1521-
0xd0b, 0xe66, 0xe26, 0x121e, 0xe06, 0xe86, 0xe46, 0x125e,
1522-
0xd07, 0xe5e, 0xe1e, 0x120e, 0xd17, 0xe7e, 0xe3e, 0x124e,
1523-
0xd0f, 0xe6e, 0xe2e, 0x122e, 0xe0e, 0xe8e, 0xe4e, 0x126e,
1524-
0xd00, 0xe51, 0xe11, 0xf19, 0xd10, 0xe71, 0xe31, 0x1234,
1525-
0xd08, 0xe61, 0xe21, 0x1214, 0xe01, 0xe81, 0xe41, 0x1254,
1526-
0xd04, 0xe59, 0xe19, 0x1204, 0xd14, 0xe79, 0xe39, 0x1244,
1527-
0xd0c, 0xe69, 0xe29, 0x1224, 0xe09, 0xe89, 0xe49, 0x1264,
1528-
0xd02, 0xe55, 0xe15, 0xf1d, 0xd12, 0xe75, 0xe35, 0x123c,
1529-
0xd0a, 0xe65, 0xe25, 0x121c, 0xe05, 0xe85, 0xe45, 0x125c,
1530-
0xd06, 0xe5d, 0xe1d, 0x120c, 0xd16, 0xe7d, 0xe3d, 0x124c,
1531-
0xd0e, 0xe6d, 0xe2d, 0x122c, 0xe0d, 0xe8d, 0xe4d, 0x126c,
1532-
0xd01, 0xe53, 0xe13, 0xf1b, 0xd11, 0xe73, 0xe33, 0x1238,
1533-
0xd09, 0xe63, 0xe23, 0x1218, 0xe03, 0xe83, 0xe43, 0x1258,
1534-
0xd05, 0xe5b, 0xe1b, 0x1208, 0xd15, 0xe7b, 0xe3b, 0x1248,
1535-
0xd0d, 0xe6b, 0xe2b, 0x1228, 0xe0b, 0xe8b, 0xe4b, 0x1268,
1536-
0xd03, 0xe57, 0xe17, 0x1200, 0xd13, 0xe77, 0xe37, 0x1240,
1537-
0xd0b, 0xe67, 0xe27, 0x1220, 0xe07, 0xe87, 0xe47, 0x1260,
1538-
0xd07, 0xe5f, 0xe1f, 0x1210, 0xd17, 0xe7f, 0xe3f, 0x1250,
1539-
0xd0f, 0xe6f, 0xe2f, 0x1230, 0xe0f, 0xe8f, 0xe4f, 0,
1532+
0xd00, 0xe50, 0xe10, 0xf18, 0xd10, 0xe70, 0xe30, 0x1230,
1533+
0xd08, 0xe60, 0xe20, 0x1210, 0xe00, 0xe80, 0xe40, 0x1250,
1534+
0xd04, 0xe58, 0xe18, 0x1200, 0xd14, 0xe78, 0xe38, 0x1240,
1535+
0xd0c, 0xe68, 0xe28, 0x1220, 0xe08, 0xe88, 0xe48, 0x1260,
1536+
0xd02, 0xe54, 0xe14, 0xf1c, 0xd12, 0xe74, 0xe34, 0x1238,
1537+
0xd0a, 0xe64, 0xe24, 0x1218, 0xe04, 0xe84, 0xe44, 0x1258,
1538+
0xd06, 0xe5c, 0xe1c, 0x1208, 0xd16, 0xe7c, 0xe3c, 0x1248,
1539+
0xd0e, 0xe6c, 0xe2c, 0x1228, 0xe0c, 0xe8c, 0xe4c, 0x1268,
1540+
0xd01, 0xe52, 0xe12, 0xf1a, 0xd11, 0xe72, 0xe32, 0x1234,
1541+
0xd09, 0xe62, 0xe22, 0x1214, 0xe02, 0xe82, 0xe42, 0x1254,
1542+
0xd05, 0xe5a, 0xe1a, 0x1204, 0xd15, 0xe7a, 0xe3a, 0x1244,
1543+
0xd0d, 0xe6a, 0xe2a, 0x1224, 0xe0a, 0xe8a, 0xe4a, 0x1264,
1544+
0xd03, 0xe56, 0xe16, 0xf1e, 0xd13, 0xe76, 0xe36, 0x123c,
1545+
0xd0b, 0xe66, 0xe26, 0x121c, 0xe06, 0xe86, 0xe46, 0x125c,
1546+
0xd07, 0xe5e, 0xe1e, 0x120c, 0xd17, 0xe7e, 0xe3e, 0x124c,
1547+
0xd0f, 0xe6e, 0xe2e, 0x122c, 0xe0e, 0xe8e, 0xe4e, 0x126c,
1548+
0xd00, 0xe51, 0xe11, 0xf19, 0xd10, 0xe71, 0xe31, 0x1232,
1549+
0xd08, 0xe61, 0xe21, 0x1212, 0xe01, 0xe81, 0xe41, 0x1252,
1550+
0xd04, 0xe59, 0xe19, 0x1202, 0xd14, 0xe79, 0xe39, 0x1242,
1551+
0xd0c, 0xe69, 0xe29, 0x1222, 0xe09, 0xe89, 0xe49, 0x1262,
1552+
0xd02, 0xe55, 0xe15, 0xf1d, 0xd12, 0xe75, 0xe35, 0x123a,
1553+
0xd0a, 0xe65, 0xe25, 0x121a, 0xe05, 0xe85, 0xe45, 0x125a,
1554+
0xd06, 0xe5d, 0xe1d, 0x120a, 0xd16, 0xe7d, 0xe3d, 0x124a,
1555+
0xd0e, 0xe6d, 0xe2d, 0x122a, 0xe0d, 0xe8d, 0xe4d, 0x126a,
1556+
0xd01, 0xe53, 0xe13, 0xf1b, 0xd11, 0xe73, 0xe33, 0x1236,
1557+
0xd09, 0xe63, 0xe23, 0x1216, 0xe03, 0xe83, 0xe43, 0x1256,
1558+
0xd05, 0xe5b, 0xe1b, 0x1206, 0xd15, 0xe7b, 0xe3b, 0x1246,
1559+
0xd0d, 0xe6b, 0xe2b, 0x1226, 0xe0b, 0xe8b, 0xe4b, 0x1266,
1560+
0xd03, 0xe57, 0xe17, 0xf1f, 0xd13, 0xe77, 0xe37, 0x123e,
1561+
0xd0b, 0xe67, 0xe27, 0x121e, 0xe07, 0xe87, 0xe47, 0x125e,
1562+
0xd07, 0xe5f, 0xe1f, 0x120e, 0xd17, 0xe7f, 0xe3f, 0x124e,
1563+
0xd0f, 0xe6f, 0xe2f, 0x122e, 0xe0f, 0xe8f, 0xe4f, 0x126e,
15401564
0x290, 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0x297,
15411565
0x298, 0x299, 0x29a, 0x29b, 0x29c, 0x29d, 0x29e, 0x29f,
15421566
0x2a0, 0x2a1, 0x2a2, 0x2a3, 0x2a4, 0x2a5, 0x2a6, 0x2a7,
@@ -1553,6 +1577,42 @@ static const uint16_t elf_zlib_default_table[0x170] =
15531577
0x2f8, 0x2f9, 0x2fa, 0x2fb, 0x2fc, 0x2fd, 0x2fe, 0x2ff,
15541578
};
15551579

1580+
static const uint16_t elf_zlib_default_dist_table[0x100] =
1581+
{
1582+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1583+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1584+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1585+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1586+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1587+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1588+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1589+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1590+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1591+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1592+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1593+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1594+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1595+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1596+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1597+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1598+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1599+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1600+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1601+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1602+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1603+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1604+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1605+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1606+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1607+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1608+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1609+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1610+
0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c,
1611+
0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e,
1612+
0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d,
1613+
0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f,
1614+
};
1615+
15561616
/* Inflate a zlib stream from PIN/SIN to POUT/SOUT. Return 1 on
15571617
success, 0 on some error parsing the stream. */
15581618

@@ -1701,7 +1761,7 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table,
17011761
if (type == 1)
17021762
{
17031763
tlit = elf_zlib_default_table;
1704-
tdist = elf_zlib_default_table;
1764+
tdist = elf_zlib_default_dist_table;
17051765
}
17061766
else
17071767
{

ztest.c

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct zlib_test
8181
{
8282
const char *name;
8383
const char *uncompressed;
84+
size_t uncompressed_len;
8485
const char *compressed;
8586
size_t compressed_len;
8687
};
@@ -102,23 +103,83 @@ static const struct zlib_test tests[] =
102103
{
103104
"empty",
104105
"",
106+
0,
105107
"\x78\x9c\x03\x00\x00\x00\x00\x01",
106108
8,
107109
},
108110
{
109111
"hello",
110112
"hello, world\n",
113+
0,
111114
("\x78\x9c\xca\x48\xcd\xc9\xc9\xd7\x51\x28\xcf"
112115
"\x2f\xca\x49\xe1\x02\x04\x00\x00\xff\xff\x21\xe7\x04\x93"),
113116
25,
114117
},
115118
{
116119
"goodbye",
117120
"goodbye, world",
121+
0,
118122
("\x78\x9c\x4b\xcf\xcf\x4f\x49\xaa"
119123
"\x4c\xd5\x51\x28\xcf\x2f\xca\x49"
120124
"\x01\x00\x28\xa5\x05\x5e"),
121125
22,
126+
},
127+
{
128+
"ranges",
129+
("\xcc\x11\x00\x00\x00\x00\x00\x00\xd5\x13\x00\x00\x00\x00\x00\x00"
130+
"\x1c\x14\x00\x00\x00\x00\x00\x00\x72\x14\x00\x00\x00\x00\x00\x00"
131+
"\x9d\x14\x00\x00\x00\x00\x00\x00\xd5\x14\x00\x00\x00\x00\x00\x00"
132+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
133+
"\xfb\x12\x00\x00\x00\x00\x00\x00\x09\x13\x00\x00\x00\x00\x00\x00"
134+
"\x0c\x13\x00\x00\x00\x00\x00\x00\xcb\x13\x00\x00\x00\x00\x00\x00"
135+
"\x29\x14\x00\x00\x00\x00\x00\x00\x4e\x14\x00\x00\x00\x00\x00\x00"
136+
"\x9d\x14\x00\x00\x00\x00\x00\x00\xd5\x14\x00\x00\x00\x00\x00\x00"
137+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
138+
"\xfb\x12\x00\x00\x00\x00\x00\x00\x09\x13\x00\x00\x00\x00\x00\x00"
139+
"\x67\x13\x00\x00\x00\x00\x00\x00\xcb\x13\x00\x00\x00\x00\x00\x00"
140+
"\x9d\x14\x00\x00\x00\x00\x00\x00\xd5\x14\x00\x00\x00\x00\x00\x00"
141+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
142+
"\x5f\x0b\x00\x00\x00\x00\x00\x00\x6c\x0b\x00\x00\x00\x00\x00\x00"
143+
"\x7d\x0b\x00\x00\x00\x00\x00\x00\x7e\x0c\x00\x00\x00\x00\x00\x00"
144+
"\x38\x0f\x00\x00\x00\x00\x00\x00\x5c\x0f\x00\x00\x00\x00\x00\x00"
145+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
146+
"\x83\x0c\x00\x00\x00\x00\x00\x00\xfa\x0c\x00\x00\x00\x00\x00\x00"
147+
"\xfd\x0d\x00\x00\x00\x00\x00\x00\xef\x0e\x00\x00\x00\x00\x00\x00"
148+
"\x14\x0f\x00\x00\x00\x00\x00\x00\x38\x0f\x00\x00\x00\x00\x00\x00"
149+
"\x9f\x0f\x00\x00\x00\x00\x00\x00\xac\x0f\x00\x00\x00\x00\x00\x00"
150+
"\xdb\x0f\x00\x00\x00\x00\x00\x00\xff\x0f\x00\x00\x00\x00\x00\x00"
151+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
152+
"\xfd\x0d\x00\x00\x00\x00\x00\x00\xd8\x0e\x00\x00\x00\x00\x00\x00"
153+
"\x9f\x0f\x00\x00\x00\x00\x00\x00\xac\x0f\x00\x00\x00\x00\x00\x00"
154+
"\xdb\x0f\x00\x00\x00\x00\x00\x00\xff\x0f\x00\x00\x00\x00\x00\x00"
155+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
156+
"\xfa\x0c\x00\x00\x00\x00\x00\x00\xea\x0d\x00\x00\x00\x00\x00\x00"
157+
"\xef\x0e\x00\x00\x00\x00\x00\x00\x14\x0f\x00\x00\x00\x00\x00\x00"
158+
"\x5c\x0f\x00\x00\x00\x00\x00\x00\x9f\x0f\x00\x00\x00\x00\x00\x00"
159+
"\xac\x0f\x00\x00\x00\x00\x00\x00\xdb\x0f\x00\x00\x00\x00\x00\x00"
160+
"\xff\x0f\x00\x00\x00\x00\x00\x00\x2c\x10\x00\x00\x00\x00\x00\x00"
161+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
162+
"\x60\x11\x00\x00\x00\x00\x00\x00\xd1\x16\x00\x00\x00\x00\x00\x00"
163+
"\x40\x0b\x00\x00\x00\x00\x00\x00\x2c\x10\x00\x00\x00\x00\x00\x00"
164+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
165+
"\x7a\x00\x00\x00\x00\x00\x00\x00\xb6\x00\x00\x00\x00\x00\x00\x00"
166+
"\x9f\x01\x00\x00\x00\x00\x00\x00\xa7\x01\x00\x00\x00\x00\x00\x00"
167+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
168+
"\x7a\x00\x00\x00\x00\x00\x00\x00\xa9\x00\x00\x00\x00\x00\x00\x00"
169+
"\x9f\x01\x00\x00\x00\x00\x00\x00\xa7\x01\x00\x00\x00\x00\x00\x00"
170+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"),
171+
672,
172+
("\x78\x9c\x3b\x23\xc8\x00\x06\x57\x85\x21\xb4\x8c\x08\x84\x2e\x82"
173+
"\xd2\x73\xa1\xf4\x55\x28\x8d\x0e\x7e\x0b\x41\x68\x4e\xa8\x7e\x1e"
174+
"\x28\x7d\x1a\x4a\x6b\x42\xf5\xf9\x91\x69\x5e\x3a\x9a\x79\x84\xf4"
175+
"\xc7\x73\x43\xe8\x1c\x28\x5d\x0b\xa5\xeb\x78\x20\xb4\x05\x3f\x84"
176+
"\x8e\xe1\xc7\xae\xbf\x19\xaa\xee\x17\x94\xfe\xcb\x0b\xa1\xdf\xf3"
177+
"\x41\x68\x11\x7e\x54\x73\xe6\x43\xe9\x35\x50\xfa\x36\x94\xfe\x8f"
178+
"\xc3\x7c\x98\x79\x37\xf8\xc8\xd3\x0f\x73\xd7\x2b\x1c\xee\x8a\x21"
179+
"\xd2\x5d\x3a\x02\xd8\xcd\x4f\x80\xa6\x87\x8b\x62\x10\xda\x81\x1b"
180+
"\xbf\xfa\x2a\x28\xbd\x0d\x4a\xcf\x67\x84\xd0\xcb\x19\xf1\xab\x5f"
181+
"\x49\xa4\x7a\x00\x48\x97\x29\xd4"),
182+
152,
122183
}
123184
};
124185

@@ -139,7 +200,9 @@ test_samples (struct backtrace_state *state)
139200

140201
p = malloc (12 + tests[i].compressed_len);
141202
memcpy (p, "ZLIB", 4);
142-
v = strlen (tests[i].uncompressed);
203+
v = tests[i].uncompressed_len;
204+
if (v == 0)
205+
v = strlen (tests[i].uncompressed);
143206
for (j = 0; j < 8; ++j)
144207
p[j + 4] = (v >> ((7 - j) * 8)) & 0xff;
145208
memcpy (p + 12, tests[i].compressed, tests[i].compressed_len);

0 commit comments

Comments
 (0)