XZ decompressor: Fix decoding of empty LZMA2 streams
PATCH 1/1 XZ decompressor: Fix decoding of empty LZMA2 streams
From: Lasse Collin <[email protected]>
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.
xen/common/xz/dec_lzma2.c +3 -3
@@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_*/ 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_lzma_reset (s); } }else { -if (tmp ==0x00 ) -return XZ_STREAM_END ; -if (tmp >0x02 )return XZ_DATA_ERROR ;
From: Lasse Collin <[email protected]>
Subject: 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.
xen/common/xz/dec_lzma2.c +3 -3
@@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_*/ 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_lzma_reset (s); } }else { -if (tmp ==0x00 ) -return XZ_STREAM_END ; -if (tmp >0x02 )return XZ_DATA_ERROR ;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel