diff options
-rw-r--r-- | archival/libarchive/decompress_unlzma.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c index c8622f97b..90a428583 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; |
@@ -432,7 +435,7 @@ unpack_lzma_stream(transformer_state_t *xstate) | |||
432 | IF_NOT_FEATURE_LZMA_FAST(string:) | 435 | IF_NOT_FEATURE_LZMA_FAST(string:) |
433 | do { | 436 | do { |
434 | uint32_t pos = buffer_pos - rep0; | 437 | uint32_t pos = buffer_pos - rep0; |
435 | while (pos >= header.dict_size) | 438 | if ((int32_t)pos < 0) |
436 | pos += header.dict_size; | 439 | pos += header.dict_size; |
437 | previous_byte = buffer[pos]; | 440 | previous_byte = buffer[pos]; |
438 | IF_NOT_FEATURE_LZMA_FAST(one_byte2:) | 441 | IF_NOT_FEATURE_LZMA_FAST(one_byte2:) |