aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-02-07 19:48:06 +0200
committerLasse Collin <lasse.collin@tukaani.org>2010-02-07 19:48:06 +0200
commit6503fde658a5cdbdd907a788865470dd64771601 (patch)
tree5a00ae67d08d92291469cdc705393eaac0dae978 /src/liblzma/common
parentFix wrong assertion. (diff)
downloadxz-6503fde658a5cdbdd907a788865470dd64771601.tar.xz
Subtle change to liblzma Block handling API.
lzma_block.version has to be initialized even for lzma_block_header_decode(). This way a future version of liblzma won't allocate memory in a way that an old application doesn't know how to free it. The subtlety of this change is that all current apps using lzma_block_header_decode() will keep working for now, because the only possible version value is zero, and lzma_block_header_decode() unconditionally sets the version to zero even now. Unless fixed, these apps will break in the future if a new version of the Block options is ever needed.
Diffstat (limited to 'src/liblzma/common')
-rw-r--r--src/liblzma/common/stream_decoder.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liblzma/common/stream_decoder.c b/src/liblzma/common/stream_decoder.c
index 60cc8247..37ea71ed 100644
--- a/src/liblzma/common/stream_decoder.c
+++ b/src/liblzma/common/stream_decoder.c
@@ -182,6 +182,9 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
coder->pos = 0;
+ // Version 0 is currently the only possible version.
+ coder->block_options.version = 0;
+
// Set up a buffer to hold the filter chain. Block Header
// decoder will initialize all members of this array so
// we don't need to do it here.