From 3a7cc5c3dec7b078941f961b0393b86c418883b6 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 23 Jan 2008 23:35:49 +0200 Subject: [PATCH] Fix decoding of Extra Records that have empty Data. --- src/liblzma/common/metadata_decoder.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/liblzma/common/metadata_decoder.c b/src/liblzma/common/metadata_decoder.c index 298a424..9704575 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: {