diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-09 13:55:11 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-09 14:02:55 +0100 |
commit | 3989e5adf454a3ab98412b249c2c9bd2a3175ae0 (patch) | |
tree | 8361ddd5dd5e4d35067ab4166f63aa482fece476 /examples/bootfloppy/etc/init.d | |
parent | 8c1d857d2582c689681c7e6d3dc299613b4a7167 (diff) | |
download | busybox-3989e5adf454a3ab98412b249c2c9bd2a3175ae0.tar.gz |
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>
Diffstat (limited to 'examples/bootfloppy/etc/init.d')
0 files changed, 0 insertions, 0 deletions