1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Fix a bug related to 99e12af4e2.

lzma_metadata.header_metadata_size was not properly set to
zero if the Metadata had only the Metadata Flags field.
This commit is contained in:
Lasse Collin 2008-01-23 23:38:18 +02:00
parent 3a7cc5c3de
commit 765f0b05f6

View file

@ -169,12 +169,6 @@ process(lzma_coder *coder, lzma_allocator *allocator)
return LZMA_DATA_ERROR; return LZMA_DATA_ERROR;
--coder->todo_count; --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; coder->sequence = SEQ_TOTAL_SIZE;
@ -494,6 +488,13 @@ metadata_decode(lzma_coder *coder, lzma_allocator *allocator,
if (coder->todo_count != 0) if (coder->todo_count != 0)
return LZMA_DATA_ERROR; return LZMA_DATA_ERROR;
// If Size of Header Metadata Block was not
// present, we use zero as its size instead
// of LZMA_VLI_VALUE_UNKNOWN.
if (coder->metadata->header_metadata_size
== LZMA_VLI_VALUE_UNKNOWN)
coder->metadata->header_metadata_size = 0;
return LZMA_STREAM_END; return LZMA_STREAM_END;
} }
} }