diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-23 23:35:49 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-23 23:35:49 +0200 |
commit | 3a7cc5c3dec7b078941f961b0393b86c418883b6 (patch) | |
tree | f5611dc02740e46a51f68bb4727a96d89f35b68a /src/liblzma/common | |
parent | Add the trailing '\0' to lzma_extra.data as the API header (diff) | |
download | xz-3a7cc5c3dec7b078941f961b0393b86c418883b6.tar.xz |
Fix decoding of Extra Records that have empty Data.
Diffstat (limited to '')
-rw-r--r-- | src/liblzma/common/metadata_decoder.c | 13 |
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: { |