aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xz
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-05-01 12:38:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-02 11:46:12 -0400
commit646032e3b05b32d3f20cb108a030593d9d792eb5 (patch)
tree1ced1d6ba3628d76ae389175b0f2c24711358d84 /lib/xz
parent3fd9952df4964fac7d5868ba48eadcc9dae3ba46 (diff)
XZ decompressor: Fix decoding of empty LZMA2 streams
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: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/xz')
-rw-r--r--lib/xz/xz_dec_lzma2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
index ea5fa4fe9d67..a6cdc969ea42 100644
--- a/lib/xz/xz_dec_lzma2.c
+++ b/lib/xz/xz_dec_lzma2.c
@@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
969 */ 969 */
970 tmp = b->in[b->in_pos++]; 970 tmp = b->in[b->in_pos++];
971 971
972 if (tmp == 0x00)
973 return XZ_STREAM_END;
974
972 if (tmp >= 0xE0 || tmp == 0x01) { 975 if (tmp >= 0xE0 || tmp == 0x01) {
973 s->lzma2.need_props = true; 976 s->lzma2.need_props = true;
974 s->lzma2.need_dict_reset = false; 977 s->lzma2.need_dict_reset = false;
@@ -1001,9 +1004,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
1001 lzma_reset(s); 1004 lzma_reset(s);
1002 } 1005 }
1003 } else { 1006 } else {
1004 if (tmp == 0x00)
1005 return XZ_STREAM_END;
1006
1007 if (tmp > 0x02) 1007 if (tmp > 0x02)
1008 return XZ_DATA_ERROR; 1008 return XZ_DATA_ERROR;
1009 1009