aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2017-03-30 19:16:55 +0300
committerLasse Collin <lasse.collin@tukaani.org>2017-03-30 19:52:24 +0300
commitef36c6362f3f3853f21b8a6359bcd06576ebf207 (patch)
tree041c1a0467662fd0f208687d0a02bc408eb32957 /src/liblzma/common
parentliblzma: Fix handling of memlimit == 0 in lzma_index_decoder(). (diff)
downloadxz-ef36c6362f3f3853f21b8a6359bcd06576ebf207.tar.xz
liblzma: Similar memlimit fix for stream_, alone_, and auto_decoder.
Diffstat (limited to 'src/liblzma/common')
-rw-r--r--src/liblzma/common/alone_decoder.c5
-rw-r--r--src/liblzma/common/auto_decoder.c5
-rw-r--r--src/liblzma/common/stream_decoder.c5
3 files changed, 3 insertions, 12 deletions
diff --git a/src/liblzma/common/alone_decoder.c b/src/liblzma/common/alone_decoder.c
index dd681765..77d0a9b1 100644
--- a/src/liblzma/common/alone_decoder.c
+++ b/src/liblzma/common/alone_decoder.c
@@ -203,9 +203,6 @@ lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
{
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
- if (memlimit == 0)
- return LZMA_PROG_ERROR;
-
lzma_alone_coder *coder = next->coder;
if (coder == NULL) {
@@ -227,7 +224,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
coder->options.preset_dict = NULL;
coder->options.preset_dict_size = 0;
coder->uncompressed_size = 0;
- coder->memlimit = memlimit;
+ coder->memlimit = my_max(1, memlimit);
coder->memusage = LZMA_MEMUSAGE_BASE;
return LZMA_OK;
diff --git a/src/liblzma/common/auto_decoder.c b/src/liblzma/common/auto_decoder.c
index 09acd6dc..479b150f 100644
--- a/src/liblzma/common/auto_decoder.c
+++ b/src/liblzma/common/auto_decoder.c
@@ -155,9 +155,6 @@ auto_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
{
lzma_next_coder_init(&auto_decoder_init, next, allocator);
- if (memlimit == 0)
- return LZMA_PROG_ERROR;
-
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
@@ -175,7 +172,7 @@ auto_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
coder->next = LZMA_NEXT_CODER_INIT;
}
- coder->memlimit = memlimit;
+ coder->memlimit = my_max(1, memlimit);
coder->flags = flags;
coder->sequence = SEQ_INIT;
diff --git a/src/liblzma/common/stream_decoder.c b/src/liblzma/common/stream_decoder.c
index 7ae7a670..fdd8ff2f 100644
--- a/src/liblzma/common/stream_decoder.c
+++ b/src/liblzma/common/stream_decoder.c
@@ -422,9 +422,6 @@ lzma_stream_decoder_init(
{
lzma_next_coder_init(&lzma_stream_decoder_init, next, allocator);
- if (memlimit == 0)
- return LZMA_PROG_ERROR;
-
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
@@ -444,7 +441,7 @@ lzma_stream_decoder_init(
coder->index_hash = NULL;
}
- coder->memlimit = memlimit;
+ coder->memlimit = my_max(1, memlimit);
coder->memusage = LZMA_MEMUSAGE_BASE;
coder->tell_no_check = (flags & LZMA_TELL_NO_CHECK) != 0;
coder->tell_unsupported_check