aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/auto_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblzma/common/auto_decoder.c')
-rw-r--r--src/liblzma/common/auto_decoder.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liblzma/common/auto_decoder.c b/src/liblzma/common/auto_decoder.c
index 479b150f..6895c7cc 100644
--- a/src/liblzma/common/auto_decoder.c
+++ b/src/liblzma/common/auto_decoder.c
@@ -139,7 +139,10 @@ auto_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
// the current memory usage.
*memusage = LZMA_MEMUSAGE_BASE;
*old_memlimit = coder->memlimit;
+
ret = LZMA_OK;
+ if (new_memlimit != 0 && new_memlimit < *memusage)
+ ret = LZMA_MEMLIMIT_ERROR;
}
if (ret == LZMA_OK && new_memlimit != 0)