diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-23 13:36:07 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-23 13:36:07 +0200 |
commit | 99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6 (patch) | |
tree | 45a3b5e6acda6b7f61e089a1297e95dfb1f75350 /src/liblzma/common/metadata_decoder.c | |
parent | Fix a memory leak in metadata_decoder.c. (diff) | |
download | xz-99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6.tar.xz |
Fix Size of Header Metadata Block handling. Now
lzma_metadata.header_metadata_size == LZMA_VLI_VALUE_UNKNOWN
is not allowed at all. To indicate missing Header Metadata
Block, header_metadata_size must be set to zero. This is
what Metadata decoder does after this patch too.
Note that other missing fields in lzma_metadata are still
indicated with LZMA_VLI_VALUE_UNKNOWN. This isn't as
illogical as it sounds at first, because missing Size of
Header Metadata Block means that Header Metadata Block is
not present in the Stream. With other Metadata fields,
a missing field means only that the value is unknown.
Diffstat (limited to 'src/liblzma/common/metadata_decoder.c')
-rw-r--r-- | src/liblzma/common/metadata_decoder.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/liblzma/common/metadata_decoder.c b/src/liblzma/common/metadata_decoder.c index 5016af61..356a9e31 100644 --- a/src/liblzma/common/metadata_decoder.c +++ b/src/liblzma/common/metadata_decoder.c @@ -169,6 +169,12 @@ process(lzma_coder *coder, lzma_allocator *allocator) return LZMA_DATA_ERROR; --coder->todo_count; + } else { + // Zero indicates that Size of Header Metadata Block + // is not present. That is, after successful Metadata + // decoding, metadata->header_metadata_size is + // never LZMA_VLI_VALUE_UNKNOWN. + coder->metadata->header_metadata_size = 0; } coder->sequence = SEQ_TOTAL_SIZE; |