]> git.ipfire.org Git - thirdparty/xz.git/commit
liblzma: Fix handling of memlimit == 0 in lzma_index_decoder().
authorLasse Collin <lasse.collin@tukaani.org>
Thu, 30 Mar 2017 15:58:18 +0000 (18:58 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 30 Mar 2017 16:10:55 +0000 (19:10 +0300)
commitcbc74017939690d13441b8926bb743fb03211b83
tree7460d31d2376db046f1ece2067c0da85a13dd88d
parent78ae13bced912b1b92ae927992c99cbcc463cae7
liblzma: Fix handling of memlimit == 0 in lzma_index_decoder().

It returned LZMA_PROG_ERROR, which was done to avoid zero as
the limit (because it's a special value elsewhere), but using
LZMA_PROG_ERROR is simply inconvenient and can cause bugs.

The fix/workaround is to treat 0 as if it were 1 byte. It's
effectively the same thing. The only weird consequence is
that then lzma_memlimit_get() will return 1 even when 0 was
specified as the limit.

This fixes a very rare corner case in xz --list where a specific
memory usage limit and a multi-stream file could print the
error message "Internal error (bug)" instead of saying that
the memory usage limit is too low.
src/liblzma/api/lzma/index.h
src/liblzma/common/index_decoder.c