• Simon Glass's avatar
    lzma: fix buffer bound check error further · f6eec89f
    Simon Glass authored
    Commit 4d3b8a0d fixed a problem with lzma decompress where it would
    run out of bytes to decompress. The algorithm needs to know how many
    uncompressed bytes it is expected to produce.
    
    However, the fix introduced a potential buffer overrun, and causes
    the compression test to fail (test_compression command in sandbox).
    
    The correct fix seems to be to use the minimum of the expected number
    of uncompressed bytes and the amount of output space available. That
    way things work normally when there is enough space, and return an
    error (without overrunning available space) when there is not.
    Signed-off-by: 's avatarAntonios Vamporakis <ant@area128.com>
    CC: Kees Cook <keescook@chromium.org>
    CC: Simon Glass <sjg@chromium.org>
    CC: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
    CC: Luka Perkov <luka@openwrt.org>
    Signed-off-by: 's avatarSimon Glass <sjg@chromium.org>
    f6eec89f
Name
Last commit
Last update
..
LzmaDec.c Loading commit data...
LzmaDec.h Loading commit data...
LzmaTools.c Loading commit data...
LzmaTools.h Loading commit data...
Makefile Loading commit data...
README.txt Loading commit data...
Types.h Loading commit data...
history.txt Loading commit data...
import_lzmasdk.sh Loading commit data...
license.txt Loading commit data...
lzma.txt Loading commit data...