aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/common.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/common.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/liblzma/common/common.c b/src/liblzma/common/common.c
index 28aa2b71..57e3f8eb 100644
--- a/src/liblzma/common/common.c
+++ b/src/liblzma/common/common.c
@@ -435,8 +435,10 @@ lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit)
|| strm->internal->next.memconfig == NULL)
return LZMA_PROG_ERROR;
- if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE)
- return LZMA_MEMLIMIT_ERROR;
+ // Zero is a special value that cannot be used as an actual limit.
+ // If 0 was specified, use 1 instead.
+ if (new_memlimit == 0)
+ new_memlimit = 1;
return strm->internal->next.memconfig(strm->internal->next.coder,
&memusage, &old_memlimit, new_memlimit);