]> git.ipfire.org Git - thirdparty/xz.git/commit
liblzma: Fix lzma_memlimit_set(strm, 0).
authorLasse Collin <lasse.collin@tukaani.org>
Thu, 30 Mar 2017 16:47:45 +0000 (19:47 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 30 Mar 2017 16:51:14 +0000 (19:51 +0300)
commita0b1dda409bc3e6e2957a2651663fc411d2caf2d
tree47a3f375dbf281258bafed65b1d9c678dbffa1ba
parent84462afaada61379f5878e46f8f00e25a1cdcf29
liblzma: Fix lzma_memlimit_set(strm, 0).

The 0 got treated specially in a buggy way and as a result
the function did nothing. The API doc said that 0 was supposed
to return LZMA_PROG_ERROR but it didn't.

Now 0 is treated as if 1 had been specified. This is done because
0 is already used to indicate an error from lzma_memlimit_get()
and lzma_memusage().

In addition, lzma_memlimit_set() no longer checks that the new
limit is at least LZMA_MEMUSAGE_BASE. It's counter-productive
for the Index decoder and was actually needed only by the
auto decoder. Auto decoder has now been modified to check for
LZMA_MEMUSAGE_BASE.
src/liblzma/api/lzma/base.h
src/liblzma/common/auto_decoder.c
src/liblzma/common/common.c