diff options
author | Ron Yorston <rmy@pobox.com> | 2017-02-08 20:09:29 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-02-08 20:09:29 +0000 |
commit | 373275a708bafb88fa4f0519de2166154f44fed9 (patch) | |
tree | 4587b4fd3f695e0f3705b2a217e199f3144df931 /archival/libarchive | |
parent | b74b2619779b1deb903b7766261807df1e9b1f7f (diff) | |
parent | c2b18583a3df06aeecf535c3cea6856aa1f2e205 (diff) | |
download | busybox-w32-373275a708bafb88fa4f0519de2166154f44fed9.tar.gz busybox-w32-373275a708bafb88fa4f0519de2166154f44fed9.tar.bz2 busybox-w32-373275a708bafb88fa4f0519de2166154f44fed9.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'archival/libarchive')
-rw-r--r-- | archival/libarchive/Kbuild.src | 3 | ||||
-rw-r--r-- | archival/libarchive/data_extract_all.c | 6 | ||||
-rw-r--r-- | archival/libarchive/decompress_bunzip2.c | 6 | ||||
-rw-r--r-- | archival/libarchive/decompress_unlzma.c | 31 |
4 files changed, 36 insertions, 10 deletions
diff --git a/archival/libarchive/Kbuild.src b/archival/libarchive/Kbuild.src index ad5c5c42d..eaf67451f 100644 --- a/archival/libarchive/Kbuild.src +++ b/archival/libarchive/Kbuild.src | |||
@@ -53,12 +53,15 @@ lib-$(CONFIG_LZOPCAT) += lzo1x_1.o lzo1x_1o.o lzo1x_d.o | |||
53 | lib-$(CONFIG_LZOP_COMPR_HIGH) += lzo1x_9x.o | 53 | lib-$(CONFIG_LZOP_COMPR_HIGH) += lzo1x_9x.o |
54 | lib-$(CONFIG_BUNZIP2) += open_transformer.o decompress_bunzip2.o | 54 | lib-$(CONFIG_BUNZIP2) += open_transformer.o decompress_bunzip2.o |
55 | lib-$(CONFIG_BZCAT) += open_transformer.o decompress_bunzip2.o | 55 | lib-$(CONFIG_BZCAT) += open_transformer.o decompress_bunzip2.o |
56 | lib-$(CONFIG_FEATURE_UNZIP_BZIP2) += open_transformer.o decompress_bunzip2.o | ||
56 | lib-$(CONFIG_UNLZMA) += open_transformer.o decompress_unlzma.o | 57 | lib-$(CONFIG_UNLZMA) += open_transformer.o decompress_unlzma.o |
57 | lib-$(CONFIG_LZCAT) += open_transformer.o decompress_unlzma.o | 58 | lib-$(CONFIG_LZCAT) += open_transformer.o decompress_unlzma.o |
58 | lib-$(CONFIG_LZMA) += open_transformer.o decompress_unlzma.o | 59 | lib-$(CONFIG_LZMA) += open_transformer.o decompress_unlzma.o |
60 | lib-$(CONFIG_FEATURE_UNZIP_LZMA) += open_transformer.o decompress_unlzma.o | ||
59 | lib-$(CONFIG_UNXZ) += open_transformer.o decompress_unxz.o | 61 | lib-$(CONFIG_UNXZ) += open_transformer.o decompress_unxz.o |
60 | lib-$(CONFIG_XZCAT) += open_transformer.o decompress_unxz.o | 62 | lib-$(CONFIG_XZCAT) += open_transformer.o decompress_unxz.o |
61 | lib-$(CONFIG_XZ) += open_transformer.o decompress_unxz.o | 63 | lib-$(CONFIG_XZ) += open_transformer.o decompress_unxz.o |
64 | lib-$(CONFIG_FEATURE_UNZIP_XZ) += open_transformer.o decompress_unxz.o | ||
62 | lib-$(CONFIG_GUNZIP) += open_transformer.o decompress_gunzip.o | 65 | lib-$(CONFIG_GUNZIP) += open_transformer.o decompress_gunzip.o |
63 | lib-$(CONFIG_ZCAT) += open_transformer.o decompress_gunzip.o | 66 | lib-$(CONFIG_ZCAT) += open_transformer.o decompress_gunzip.o |
64 | lib-$(CONFIG_UNCOMPRESS) += open_transformer.o decompress_uncompress.o | 67 | lib-$(CONFIG_UNCOMPRESS) += open_transformer.o decompress_uncompress.o |
diff --git a/archival/libarchive/data_extract_all.c b/archival/libarchive/data_extract_all.c index bd034afdc..1830ffb8d 100644 --- a/archival/libarchive/data_extract_all.c +++ b/archival/libarchive/data_extract_all.c | |||
@@ -127,8 +127,9 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) | |||
127 | if (hard_link) { | 127 | if (hard_link) { |
128 | res = link(hard_link, dst_name); | 128 | res = link(hard_link, dst_name); |
129 | if (res != 0 && !(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)) { | 129 | if (res != 0 && !(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)) { |
130 | /* shared message */ | ||
130 | bb_perror_msg("can't create %slink " | 131 | bb_perror_msg("can't create %slink " |
131 | "from %s to %s", "hard", | 132 | "%s to %s", "hard", |
132 | dst_name, | 133 | dst_name, |
133 | hard_link); | 134 | hard_link); |
134 | } | 135 | } |
@@ -181,8 +182,9 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) | |||
181 | if (res != 0 | 182 | if (res != 0 |
182 | && !(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET) | 183 | && !(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET) |
183 | ) { | 184 | ) { |
185 | /* shared message */ | ||
184 | bb_perror_msg("can't create %slink " | 186 | bb_perror_msg("can't create %slink " |
185 | "from %s to %s", "sym", | 187 | "%s to %s", "sym", |
186 | dst_name, | 188 | dst_name, |
187 | file_header->link_target); | 189 | file_header->link_target); |
188 | } | 190 | } |
diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c index fe5953da2..4fb989c29 100644 --- a/archival/libarchive/decompress_bunzip2.c +++ b/archival/libarchive/decompress_bunzip2.c | |||
@@ -134,7 +134,7 @@ static unsigned get_bits(bunzip_data *bd, int bits_wanted) | |||
134 | 134 | ||
135 | /* Avoid 32-bit overflow (dump bit buffer to top of output) */ | 135 | /* Avoid 32-bit overflow (dump bit buffer to top of output) */ |
136 | if (bit_count >= 24) { | 136 | if (bit_count >= 24) { |
137 | bits = bd->inbufBits & ((1 << bit_count) - 1); | 137 | bits = bd->inbufBits & ((1U << bit_count) - 1); |
138 | bits_wanted -= bit_count; | 138 | bits_wanted -= bit_count; |
139 | bits <<= bits_wanted; | 139 | bits <<= bits_wanted; |
140 | bit_count = 0; | 140 | bit_count = 0; |
@@ -158,11 +158,11 @@ static int get_next_block(bunzip_data *bd) | |||
158 | { | 158 | { |
159 | struct group_data *hufGroup; | 159 | struct group_data *hufGroup; |
160 | int dbufCount, dbufSize, groupCount, *base, *limit, selector, | 160 | int dbufCount, dbufSize, groupCount, *base, *limit, selector, |
161 | i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256]; | 161 | i, j, runPos, symCount, symTotal, nSelectors, byteCount[256]; |
162 | int runCnt = runCnt; /* for compiler */ | 162 | int runCnt = runCnt; /* for compiler */ |
163 | uint8_t uc, symToByte[256], mtfSymbol[256], *selectors; | 163 | uint8_t uc, symToByte[256], mtfSymbol[256], *selectors; |
164 | uint32_t *dbuf; | 164 | uint32_t *dbuf; |
165 | unsigned origPtr; | 165 | unsigned origPtr, t; |
166 | 166 | ||
167 | dbuf = bd->dbuf; | 167 | dbuf = bd->dbuf; |
168 | dbufSize = bd->dbufSize; | 168 | dbufSize = bd->dbufSize; |
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c index c8622f97b..a9040877e 100644 --- a/archival/libarchive/decompress_unlzma.c +++ b/archival/libarchive/decompress_unlzma.c | |||
@@ -278,9 +278,10 @@ unpack_lzma_stream(transformer_state_t *xstate) | |||
278 | 278 | ||
279 | if (state >= LZMA_NUM_LIT_STATES) { | 279 | if (state >= LZMA_NUM_LIT_STATES) { |
280 | int match_byte; | 280 | int match_byte; |
281 | uint32_t pos = buffer_pos - rep0; | 281 | uint32_t pos; |
282 | 282 | ||
283 | while (pos >= header.dict_size) | 283 | pos = buffer_pos - rep0; |
284 | if ((int32_t)pos < 0) | ||
284 | pos += header.dict_size; | 285 | pos += header.dict_size; |
285 | match_byte = buffer[pos]; | 286 | match_byte = buffer[pos]; |
286 | do { | 287 | do { |
@@ -336,9 +337,11 @@ unpack_lzma_stream(transformer_state_t *xstate) | |||
336 | ); | 337 | ); |
337 | if (!rc_is_bit_1(rc, prob2)) { | 338 | if (!rc_is_bit_1(rc, prob2)) { |
338 | #if ENABLE_FEATURE_LZMA_FAST | 339 | #if ENABLE_FEATURE_LZMA_FAST |
339 | uint32_t pos = buffer_pos - rep0; | 340 | uint32_t pos; |
340 | state = state < LZMA_NUM_LIT_STATES ? 9 : 11; | 341 | state = state < LZMA_NUM_LIT_STATES ? 9 : 11; |
341 | while (pos >= header.dict_size) | 342 | |
343 | pos = buffer_pos - rep0; | ||
344 | if ((int32_t)pos < 0) | ||
342 | pos += header.dict_size; | 345 | pos += header.dict_size; |
343 | previous_byte = buffer[pos]; | 346 | previous_byte = buffer[pos]; |
344 | goto one_byte1; | 347 | goto one_byte1; |
@@ -429,10 +432,25 @@ unpack_lzma_stream(transformer_state_t *xstate) | |||
429 | } | 432 | } |
430 | 433 | ||
431 | len += LZMA_MATCH_MIN_LEN; | 434 | len += LZMA_MATCH_MIN_LEN; |
435 | /* | ||
436 | * LZMA SDK has this optimized: | ||
437 | * it precalculates size and copies many bytes | ||
438 | * in a loop with simpler checks, a-la: | ||
439 | * do | ||
440 | * *(dest) = *(dest + ofs); | ||
441 | * while (++dest != lim); | ||
442 | * and | ||
443 | * do { | ||
444 | * buffer[buffer_pos++] = buffer[pos]; | ||
445 | * if (++pos == header.dict_size) | ||
446 | * pos = 0; | ||
447 | * } while (--cur_len != 0); | ||
448 | * Our code is slower (more checks per byte copy): | ||
449 | */ | ||
432 | IF_NOT_FEATURE_LZMA_FAST(string:) | 450 | IF_NOT_FEATURE_LZMA_FAST(string:) |
433 | do { | 451 | do { |
434 | uint32_t pos = buffer_pos - rep0; | 452 | uint32_t pos = buffer_pos - rep0; |
435 | while (pos >= header.dict_size) | 453 | if ((int32_t)pos < 0) |
436 | pos += header.dict_size; | 454 | pos += header.dict_size; |
437 | previous_byte = buffer[pos]; | 455 | previous_byte = buffer[pos]; |
438 | IF_NOT_FEATURE_LZMA_FAST(one_byte2:) | 456 | IF_NOT_FEATURE_LZMA_FAST(one_byte2:) |
@@ -448,6 +466,9 @@ unpack_lzma_stream(transformer_state_t *xstate) | |||
448 | } while (len != 0 && buffer_pos < header.dst_size); | 466 | } while (len != 0 && buffer_pos < header.dst_size); |
449 | /* FIXME: ...........^^^^^ | 467 | /* FIXME: ...........^^^^^ |
450 | * shouldn't it be "global_pos + buffer_pos < header.dst_size"? | 468 | * shouldn't it be "global_pos + buffer_pos < header.dst_size"? |
469 | * It probably should, but it is a "do we accidentally | ||
470 | * unpack more bytes than expected?" check - which | ||
471 | * never happens for well-formed compression data... | ||
451 | */ | 472 | */ |
452 | } | 473 | } |
453 | } | 474 | } |