diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2012-12-19 12:28:13 +0100 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2012-12-19 12:28:13 +0100 |
commit | d6103b83c6c020de8a0b5e0e28bdcfd74eb1351e (patch) | |
tree | fa7209ea8ad82abf3f264ec95b364c9f874ddde0 | |
parent | c6a50d43cfe07a5637ad8f5ade8c63c3e855ea0e (diff) | |
download | xen-d6103b83c6c020de8a0b5e0e28bdcfd74eb1351e.tar.gz xen-d6103b83c6c020de8a0b5e0e28bdcfd74eb1351e.tar.bz2 xen-d6103b83c6c020de8a0b5e0e28bdcfd74eb1351e.zip |
XZ decompressor: Fix decoding of empty LZMA2 streams
From: Lasse Collin <lasse.collin@tukaani.org>
The old code considered valid empty LZMA2 streams to be corrupt.
Note that a typical empty .xz file has no LZMA2 data at all,
and thus most .xz files having no uncompressed data are handled
correctly even without this fix.
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset: 23869:db1ea4b127cd
xen-unstable date: Thu Sep 22 17:33:48 UTC 2011
-rw-r--r-- | xen/common/xz/dec_lzma2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/xen/common/xz/dec_lzma2.c b/xen/common/xz/dec_lzma2.c index d4e8264b7b..779221dfa5 100644 --- a/xen/common/xz/dec_lzma2.c +++ b/xen/common/xz/dec_lzma2.c @@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret INIT 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 INIT 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; |