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>

authored by Lasse Collin and committed by Linus Torvalds 646032e3 3fd9952d

+3 -3
+3 -3
lib/xz/xz_dec_lzma2.c
··· 969 969 */ 970 970 tmp = b->in[b->in_pos++]; 971 971 972 + if (tmp == 0x00) 973 + return XZ_STREAM_END; 974 + 972 975 if (tmp >= 0xE0 || tmp == 0x01) { 973 976 s->lzma2.need_props = true; 974 977 s->lzma2.need_dict_reset = false; ··· 1004 1001 lzma_reset(s); 1005 1002 } 1006 1003 } else { 1007 - if (tmp == 0x00) 1008 - return XZ_STREAM_END; 1009 - 1010 1004 if (tmp > 0x02) 1011 1005 return XZ_DATA_ERROR; 1012 1006