aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/block_header_decoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2014-08-05 22:03:30 +0300
committerLasse Collin <lasse.collin@tukaani.org>2014-08-05 22:03:30 +0300
commit0e0f34b8e4f1c60ecaec15c2105982381cc9c3e6 (patch)
treeb3bf3edf8e17dcb53f0bad5edc6403947a5ef72d /src/liblzma/common/block_header_decoder.c
parentliblzma: Use lzma_memcmplen() in the BT3 match finder. (diff)
downloadxz-0e0f34b8e4f1c60ecaec15c2105982381cc9c3e6.tar.xz
liblzma: Add support for lzma_block.ignore_check.
Note that this slightly changes how lzma_block_header_decode() has been documented. Earlier it said that the .version is set to the lowest required value, but now it says that the .version field is kept unchanged if possible. In practice this doesn't affect any old code, because before this commit the only possible .version was 0.
Diffstat (limited to 'src/liblzma/common/block_header_decoder.c')
-rw-r--r--src/liblzma/common/block_header_decoder.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/liblzma/common/block_header_decoder.c b/src/liblzma/common/block_header_decoder.c
index 416642cd..1dd982f6 100644
--- a/src/liblzma/common/block_header_decoder.c
+++ b/src/liblzma/common/block_header_decoder.c
@@ -46,8 +46,16 @@ lzma_block_header_decode(lzma_block *block,
block->filters[i].options = NULL;
}
- // Always zero for now.
- block->version = 0;
+ // Versions 0 and 1 are supported. If a newer version was specified,
+ // we need to downgrade it.
+ if (block->version > 1)
+ block->version = 1;
+
+ // This isn't a Block Header option, but since the decompressor will
+ // read it if version >= 1, it's better to initialize it here than
+ // to expect the caller to do it since in almost all cases this
+ // should be false.
+ block->ignore_check = false;
// Validate Block Header Size and Check type. The caller must have
// already set these, so it is a programming error if this test fails.