busybox/archival
Lasse Collin c3045edec2 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.
Thanks to Jindrich Novy for telling me that such a bug report
exists, Phillip Lougher for providing excellent debug info,
and other people on #fedora-ppc.

This also fixes a similar bug in single-call mode where the
uncompressed size of a XZ 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>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-27 16:39:56 +01:00
..
libarchive xz: fix incorrect XZ_BUF_ERROR 2013-02-27 16:39:56 +01:00
ar.c rename archive.h to bb_archive.h. no code changes 2011-09-22 12:45:14 +02:00
bbunzip_test.sh add tests for gunzip 2007-10-05 15:27:03 +00:00
bbunzip_test2.sh add tests for gunzip 2007-10-05 15:27:03 +00:00
bbunzip_test3.sh add tests for gunzip 2007-10-05 15:27:03 +00:00
bbunzip.c Move seamless .Z support into unpack_gz_stream 2012-03-06 16:32:06 +01:00
bzip2.c update seamless uncompression code 2012-03-06 16:27:48 +01:00
Config.src Move seamless .Z support into unpack_gz_stream 2012-03-06 16:32:06 +01:00
cpio.c whitespace cleanup. no code changes 2013-01-14 15:57:44 +01:00
dpkg_deb.c rename archive.h to bb_archive.h. no code changes 2011-09-22 12:45:14 +02:00
dpkg.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
gzip.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
Kbuild.src rename archival/libunarchive -> archival/libarchive; move bz/ into it 2010-11-03 02:38:31 +01:00
lzop.c whitespace cleanup. no code changes 2013-01-14 15:57:44 +01:00
rpm.c rpm: unmap rpm file before working with next one 2013-02-20 16:01:48 +01:00
rpm.h *: make GNU licensing statement forms more regular 2010-08-16 20:14:46 +02:00
rpm2cpio.c tar,rpm2cpio: check that child decompressor did not error out 2012-03-06 16:33:42 +01:00
tar.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
unzip.c unzip: add missing fflush; code shrink 2013-01-22 11:16:08 +01:00