aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-01-23 23:43:00 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-01-23 23:43:00 +0200
commitdb9df0a9609c01a00a227329fb96e983971040f5 (patch)
treec3aed9ffbc2d23c43dd78ca24c9734bddbd371f4 /src/liblzma/common
parentFix a bug related to 99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6. (diff)
downloadxz-db9df0a9609c01a00a227329fb96e983971040f5.tar.xz
Fix decoding of empty Metadata Blocks, that don't have
even the Metadata Flags field. Earlier the code allowed such files; now they are prohibited as the file format specification requires.
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/metadata_decoder.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/liblzma/common/metadata_decoder.c b/src/liblzma/common/metadata_decoder.c
index 8ff4e25f..579b0a51 100644
--- a/src/liblzma/common/metadata_decoder.c
+++ b/src/liblzma/common/metadata_decoder.c
@@ -127,6 +127,8 @@ process(lzma_coder *coder, lzma_allocator *allocator)
if (coder->buffer[coder->buffer_pos] & 0x70)
return LZMA_HEADER_ERROR;
+ coder->todo_count = 0;
+
// If Size of Header Metadata is present, prepare the
// variable for variable-length integer decoding. Otherwise
// set it to LZMA_VLI_VALUE_UNKNOWN to indicate that the
@@ -535,7 +537,7 @@ metadata_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
metadata->extra = NULL;
next->coder->sequence = SEQ_FLAGS;
- next->coder->todo_count = 0;
+ next->coder->todo_count = 1;
next->coder->pos = 0;
next->coder->tmp = 0;
next->coder->metadata = metadata;