diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-03-31 11:58:14 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2011-03-31 11:58:14 +0300 |
commit | 4cec51e1be4797a4bd8b266a1d34cabd7fdb79fd (patch) | |
tree | ee722671018af4977cdb7c52b7f746c14e44e6f2 /linux/lib | |
parent | 79a1581e227f8ced14bb011d9b5cca5c7349258a (diff) | |
download | xz-embedded-4cec51e1be4797a4bd8b266a1d34cabd7fdb79fd.tar.gz |
Fix decoding of LZMA2 streams having no uncompressed data.
No .xz encoder creates files with empty LZMA2 streams,
but such files would still be valid and decompressors
must accept them.
Note that empty .xz files are a different thing than
empty LZMA2 streams. This bug didn't affect typical .xz
files that had no uncompressed data.
Diffstat (limited to 'linux/lib')
-rw-r--r-- | linux/lib/xz/xz_dec_lzma2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/linux/lib/xz/xz_dec_lzma2.c b/linux/lib/xz/xz_dec_lzma2.c index ea5fa4f..a6cdc96 100644 --- a/linux/lib/xz/xz_dec_lzma2.c +++ b/linux/lib/xz/xz_dec_lzma2.c @@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, */ tmp = b->in[b->in_pos++]; + if (tmp == 0x00) + return XZ_STREAM_END; + if (tmp >= 0xE0 || tmp == 0x01) { s->lzma2.need_props = true; s->lzma2.need_dict_reset = false; @@ -1001,9 +1004,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, lzma_reset(s); } } else { - if (tmp == 0x00) - return XZ_STREAM_END; - if (tmp > 0x02) return XZ_DATA_ERROR; |