XZ decompressor: Fix decoding of empty LZMA2 streams
Lasse Collin
maintainerPATCH 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.
---
lib/xz/xz_dec_lzma2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/xz/xz_dec_lzma2.c +3 -3
@@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(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(slzma_reset (s); } }else { -if (tmp ==0x00 ) -return XZ_STREAM_END ; -if (tmp >0x02 )return XZ_DATA_ERROR ;
Quoted 8 lines · On Sun, 1 May 2011 19:38:42 +0300 Lasse Collin <[email protected]> wrote:
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.
Signed-off-by Lasse Collin <[email protected]>
The patch didn't have the cc:stable tag, but appears to be needed in 2.6.38.x and perhaps earlier, yes?
It's commit 646032e3b05b32d3f20cb108a030593d9d792eb5 in mainline.
Quoted 27 lines
lib/xz/xz_dec_lzma2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)diff -uprN
linux-2.6.39-rc5-git5.orig/lib/xz/xz_dec_lzma2.clinux-2.6.39-rc5-git5/lib/xz/xz_dec_lzma2.clib/xz/xz_dec_lzma2.c +3
-3@@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(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(slzma_reset (s); } }else { -if (tmp ==0x00 ) -return XZ_STREAM_END ; -if (tmp >0x02 )return XZ_DATA_ERROR ;
Lasse Collin
maintainerQuoted 8 lines · On 2011-05-04 Andrew Morton wrote:
Quoted 7 lines · Lasse Collin
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.
Quoted 6 lines
Quoted 1 line
Signed-off-by Lasse Collin <[email protected]>The patch didn't have the cc:stable tag, but appears to be needed in 2.6.38.x and perhaps earlier, yes?
It's commit
646032e3b05b32d3f20cb108a030593d9d792eb5in mainline.
Thanks. It's good for 2.6.38.x. Older ones don't have XZ support.
Signature · 1 line
Lasse Collin | IRC: Larhzu @ IRCnet & Freenode
Quoted 9 lines · Lasse Collin
Quoted 8 lines · On 2011-05-04 Andrew Morton wrote:
Quoted 7 lines · Lasse Collin
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.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Lasse Collin <[email protected]>The patch didn't have the cc:stable tag, but appears to be needed in 2.6.38.x and perhaps earlier, yes?
It's commit
646032e3b05b32d3f20cb108a030593d9d792eb5in mainline.Thanks. It's good for 2.6.38.x. Older ones don't have XZ support.
Now queued up, thanks.
greg k-h