busybox/archival
Denys Vlasenko 3989e5adf4 unlzma: fix erroneous "while" instead of "if". Closes 4682
These parts of the code essentially check whether
stepping back by rep0 goes negative or not.

LZMA SDK from lzma1604.7z has the following in the corresponding places:

... = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]

Clearly, not loop here.

Technically, "while" here works: if condition is false (because pos
underflowed), it iterates once, adds header.dict_size (a.k.a. dicBufSize),
this makes pos positive but smaller than header.dict_size, and loop exits.

Now we'll just check for negative result of subtraction, which is less code:

function                                             old     new   delta
unpack_lzma_stream                                  2659    2641     -18

(I hope 2 Gbyte+ dictionaries won't be in use soon).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09 14:02:55 +01:00
..
libarchive unlzma: fix erroneous "while" instead of "if". Closes 4682 2017-01-09 14:02:55 +01:00
ar.c tweak defconfig 2015-10-25 20:36:03 +01: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_test.sh add tests for gunzip 2007-10-05 15:27:03 +00:00
bbunzip.c unzip: optional support for bzip2 and lzma 2017-01-09 10:58:37 +01:00
bzip2.c Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2 2017-01-09 09:03:31 +01:00
Config.src Make bzcat, lzcat, xzcat, zcat, lzopcat, unlzop individually selectable 2016-11-16 15:45:05 +01:00
cpio.c cpio: tweak help text 2016-07-08 12:52:24 +02:00
dpkg_deb.c Make DPKG=y and DPKG_DEB=y by default 2016-12-23 13:52:53 +01:00
dpkg.c Make DPKG=y and DPKG_DEB=y by default 2016-12-23 13:52:53 +01:00
gzip.c Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2 2017-01-09 09:03:31 +01:00
Kbuild.src cpio: implement -R/--owner 2015-10-16 17:24:46 +02:00
lzop.c Make bzcat, lzcat, xzcat, zcat, lzopcat, unlzop individually selectable 2016-11-16 15:45:05 +01:00
rpm2cpio.c zcat: complain if input is not compressed 2014-02-02 02:06:38 +01:00
rpm.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
rpm.h *: make GNU licensing statement forms more regular 2010-08-16 20:14:46 +02:00
tar.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
unzip.c unzip: match "Defl:?" display with info-zip; cosmetic code shuffling 2017-01-09 13:10:10 +01:00