aboutsummaryrefslogtreecommitdiff
path: root/archival/libarchive
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-05-14 08:17:12 +0100
committerRon Yorston <rmy@pobox.com>2021-05-14 08:17:12 +0100
commita3f5a1b7f4275f713acf22f534f95c0da8392e53 (patch)
tree49b65422a3e9c33f508da9ccf3ae79d324bd9e96 /archival/libarchive
parent375cda9a88024135d630ca8990d9aff4ea414e89 (diff)
parent7de0ab21d939a5a304157f75918d0318a95261a3 (diff)
downloadbusybox-w32-a3f5a1b7f4275f713acf22f534f95c0da8392e53.tar.gz
busybox-w32-a3f5a1b7f4275f713acf22f534f95c0da8392e53.tar.bz2
busybox-w32-a3f5a1b7f4275f713acf22f534f95c0da8392e53.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'archival/libarchive')
-rw-r--r--archival/libarchive/decompress_gunzip.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
index b2a3eb1c2..d2f7a9309 100644
--- a/archival/libarchive/decompress_gunzip.c
+++ b/archival/libarchive/decompress_gunzip.c
@@ -220,10 +220,19 @@ static const uint8_t border[] ALIGN1 = {
220 * each table. 220 * each table.
221 * t: table to free 221 * t: table to free
222 */ 222 */
223#define BAD_HUFT(p) ((uintptr_t)(p) & 1)
224#define ERR_RET ((huft_t*)(uintptr_t)1)
223static void huft_free(huft_t *p) 225static void huft_free(huft_t *p)
224{ 226{
225 huft_t *q; 227 huft_t *q;
226 228
229 /*
230 * If 'p' has the error bit set we have to clear it, otherwise we might run
231 * into a segmentation fault or an invalid pointer to free(p)
232 */
233 //if (BAD_HUFT(p)) // commented out, since bit clearing has effect only if condition is true
234 p = (huft_t*)((uintptr_t)p & ~(uintptr_t)ERR_RET);
235
227 /* Go through linked list, freeing from the malloced (t[-1]) address. */ 236 /* Go through linked list, freeing from the malloced (t[-1]) address. */
228 while (p) { 237 while (p) {
229 q = (--p)->v.t; 238 q = (--p)->v.t;
@@ -289,8 +298,6 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
289 * or a valid pointer to a Huffman table, ORed with 0x1 if incompete table 298 * or a valid pointer to a Huffman table, ORed with 0x1 if incompete table
290 * is given: "fixed inflate" decoder feeds us such data. 299 * is given: "fixed inflate" decoder feeds us such data.
291 */ 300 */
292#define BAD_HUFT(p) ((uintptr_t)(p) & 1)
293#define ERR_RET ((huft_t*)(uintptr_t)1)
294static huft_t* huft_build(const unsigned *b, const unsigned n, 301static huft_t* huft_build(const unsigned *b, const unsigned n,
295 const unsigned s, const struct cp_ext *cp_ext, 302 const unsigned s, const struct cp_ext *cp_ext,
296 unsigned *m) 303 unsigned *m)