dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/lib/xz
Lasse Collin 9c1f8594df XZ: Fix incorrect XZ_BUF_ERROR
xz_dec_run() could incorrectly return XZ_BUF_ERROR if all of the
following was true:

 - The caller knows how many bytes of output to expect and only provides
   that much output space.

 - When the last output bytes are decoded, the caller-provided input
   buffer ends right before the LZMA2 end of payload marker.  So LZMA2
   won't provide more output anymore, but it won't know it yet and thus
   won't return XZ_STREAM_END yet.

 - A BCJ filter is in use and it hasn't left any unfiltered bytes in the
   temp buffer.  This can happen with any BCJ filter, but in practice
   it's more likely with filters other than the x86 BCJ.

This fixes <https://bugzilla.redhat.com/show_bug.cgi?id=735408> where
Squashfs thinks that a valid file system is corrupt.

This also fixes a similar bug in single-call mode where the uncompressed
size of a block using BCJ + LZMA2 was 0 bytes and caller provided no
output space.  Many empty .xz files don't contain any blocks and thus
don't trigger this bug.

This also tweaks a closely related detail: xz_dec_bcj_run() could call
xz_dec_lzma2_run() to decode into temp buffer when it was known to be
useless.  This was harmless although it wasted a minuscule number of CPU
cycles.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Cc: stable <stable@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 13:39:59 -07:00
..
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile decompressors: add XZ decompressor module 2011-01-13 08:03:24 -08:00
xz_crc32.c decompressors: add XZ decompressor module 2011-01-13 08:03:24 -08:00
xz_dec_bcj.c XZ: Fix incorrect XZ_BUF_ERROR 2011-09-21 13:39:59 -07:00
xz_dec_lzma2.c XZ decompressor: Fix decoding of empty LZMA2 streams 2011-05-02 08:46:12 -07:00
xz_dec_stream.c decompressors: add XZ decompressor module 2011-01-13 08:03:24 -08:00
xz_dec_syms.c decompressors: add XZ decompressor module 2011-01-13 08:03:24 -08:00
xz_dec_test.c decompressors: add XZ decompressor module 2011-01-13 08:03:24 -08:00
xz_lzma2.h decompressors: add XZ decompressor module 2011-01-13 08:03:24 -08:00
xz_private.h XZ: Fix missing <linux/kernel.h> include 2011-07-24 10:00:08 -07:00
xz_stream.h decompressors: add XZ decompressor module 2011-01-13 08:03:24 -08:00