aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/metadata_decoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-01-23 23:38:18 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-01-23 23:38:18 +0200
commit765f0b05f6e95ed9194fb90819cee189ebbac36b (patch)
tree52fc25a976295204aea204d480cc90951702d676 /src/liblzma/common/metadata_decoder.c
parentFix decoding of Extra Records that have empty Data. (diff)
downloadxz-765f0b05f6e95ed9194fb90819cee189ebbac36b.tar.xz
Fix a bug related to 99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6.
lzma_metadata.header_metadata_size was not properly set to zero if the Metadata had only the Metadata Flags field.
Diffstat (limited to 'src/liblzma/common/metadata_decoder.c')
-rw-r--r--src/liblzma/common/metadata_decoder.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/liblzma/common/metadata_decoder.c b/src/liblzma/common/metadata_decoder.c
index 97045750..8ff4e25f 100644
--- a/src/liblzma/common/metadata_decoder.c
+++ b/src/liblzma/common/metadata_decoder.c
@@ -169,12 +169,6 @@ 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;
@@ -494,6 +488,13 @@ metadata_decode(lzma_coder *coder, lzma_allocator *allocator,
if (coder->todo_count != 0)
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;
}
}