aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-03-31 11:54:48 +0300
committerLasse Collin <lasse.collin@tukaani.org>2011-03-31 11:54:48 +0300
commit0d21f49a809dc2088da6cc0da7f948404df7ecfa (patch)
tree414491bacaaeeb5a7f1ec2e736475a42c93075e9 /src/liblzma
parentScripts: Better fix for xzgrep. (diff)
downloadxz-0d21f49a809dc2088da6cc0da7f948404df7ecfa.tar.xz
liblzma: Fix decoding of LZMA2 streams having no uncompressed data.
The decoder considered empty LZMA2 streams to be corrupt. This shouldn't matter much with .xz files, because no encoder creates empty LZMA2 streams in .xz. This bug is more likely to cause problems in applications that use raw LZMA2 streams.
Diffstat (limited to '')
-rw-r--r--src/liblzma/lzma/lzma2_decoder.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liblzma/lzma/lzma2_decoder.c b/src/liblzma/lzma/lzma2_decoder.c
index f38879ce..3e42575d 100644
--- a/src/liblzma/lzma/lzma2_decoder.c
+++ b/src/liblzma/lzma/lzma2_decoder.c
@@ -67,6 +67,10 @@ lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
const uint32_t control = in[*in_pos];
++*in_pos;
+ // End marker
+ if (control == 0x00)
+ return LZMA_STREAM_END;
+
if (control >= 0xE0 || control == 1) {
// Dictionary reset implies that next LZMA chunk has
// to set new properties.
@@ -104,10 +108,6 @@ lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
&coder->options);
}
} else {
- // End marker
- if (control == 0x00)
- return LZMA_STREAM_END;
-
// Invalid control values
if (control > 2)
return LZMA_DATA_ERROR;