aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/liblzma/common/metadata_decoder.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/liblzma/common/metadata_decoder.c b/src/liblzma/common/metadata_decoder.c
index 298a424c..97045750 100644
--- a/src/liblzma/common/metadata_decoder.c
+++ b/src/liblzma/common/metadata_decoder.c
@@ -356,7 +356,18 @@ process(lzma_coder *coder, lzma_allocator *allocator)
case SEQ_EXTRA_SIZE:
case SEQ_EXTRA_DUMMY_SIZE:
read_vli(coder->tmp);
- ++coder->sequence;
+
+ if (coder->tmp == 0) {
+ // We have no Data in the Extra Record. Don't
+ // allocate any memory for it. Go back to
+ // SEQ_EXTRA_ALLOC or SEQ_EXTRA_DUMMY_ALLOC.
+ coder->tmp = 0;
+ coder->sequence -= 2;
+ coder->todo_count = 0;
+ } else {
+ ++coder->sequence;
+ }
+
break;
case SEQ_EXTRA_DATA_ALLOC: {