aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/libarchive/decompress_unlzma.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c
index 80a453806..42efd5aa7 100644
--- a/archival/libarchive/decompress_unlzma.c
+++ b/archival/libarchive/decompress_unlzma.c
@@ -224,6 +224,7 @@ unpack_lzma_stream(transformer_state_t *xstate)
224 rc_t *rc; 224 rc_t *rc;
225 int i; 225 int i;
226 uint8_t *buffer; 226 uint8_t *buffer;
227 uint32_t buffer_size;
227 uint8_t previous_byte = 0; 228 uint8_t previous_byte = 0;
228 size_t buffer_pos = 0, global_pos = 0; 229 size_t buffer_pos = 0, global_pos = 0;
229 int len = 0; 230 int len = 0;
@@ -253,7 +254,8 @@ unpack_lzma_stream(transformer_state_t *xstate)
253 if (header.dict_size == 0) 254 if (header.dict_size == 0)
254 header.dict_size++; 255 header.dict_size++;
255 256
256 buffer = xmalloc(MIN(header.dst_size, header.dict_size)); 257 buffer_size = MIN(header.dst_size, header.dict_size);
258 buffer = xmalloc(buffer_size);
257 259
258 { 260 {
259 int num_probs; 261 int num_probs;
@@ -464,7 +466,10 @@ unpack_lzma_stream(transformer_state_t *xstate)
464 if ((int32_t)pos < 0) { 466 if ((int32_t)pos < 0) {
465 pos += header.dict_size; 467 pos += header.dict_size;
466 /* bug 10436 has an example file where this triggers: */ 468 /* bug 10436 has an example file where this triggers: */
467 if ((int32_t)pos < 0) 469 //if ((int32_t)pos < 0)
470 // goto bad;
471 /* more stringent test (see unzip_bad_lzma_1.zip): */
472 if (pos >= buffer_size)
468 goto bad; 473 goto bad;
469 } 474 }
470 previous_byte = buffer[pos]; 475 previous_byte = buffer[pos];