aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/liblzma/common/microlzma_decoder.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/liblzma/common/microlzma_decoder.c b/src/liblzma/common/microlzma_decoder.c
index ba2f10ad..e473373d 100644
--- a/src/liblzma/common/microlzma_decoder.c
+++ b/src/liblzma/common/microlzma_decoder.c
@@ -80,10 +80,17 @@ microlzma_decode(void *coder_ptr, const lzma_allocator *allocator,
return LZMA_OK;
lzma_options_lzma options = {
+ .dict_size = coder->dict_size,
.preset_dict = NULL,
.preset_dict_size = 0,
+ .ext_flags = 0, // EOPM not allowed when size is known
+ .ext_size_low = UINT32_MAX, // Unknown size by default
+ .ext_size_high = UINT32_MAX,
};
+ if (coder->uncomp_size_is_exact)
+ lzma_set_ext_size(options, coder->uncomp_size);
+
// The properties are stored as bitwise-negation
// of the typical encoding.
if (lzma_lzma_lclppb_decode(&options, ~in[*in_pos]))
@@ -92,10 +99,9 @@ microlzma_decode(void *coder_ptr, const lzma_allocator *allocator,
++*in_pos;
// Initialize the decoder.
- options.dict_size = coder->dict_size;
lzma_filter_info filters[2] = {
{
- .id = LZMA_FILTER_LZMA1,
+ .id = LZMA_FILTER_LZMA1EXT,
.init = &lzma_lzma_decoder_init,
.options = &options,
}, {
@@ -106,11 +112,6 @@ microlzma_decode(void *coder_ptr, const lzma_allocator *allocator,
return_if_error(lzma_next_filter_init(&coder->lzma,
allocator, filters));
- // Use a hack to set the uncompressed size.
- if (coder->uncomp_size_is_exact)
- lzma_lz_decoder_uncompressed(coder->lzma.coder,
- coder->uncomp_size, false);
-
// Pass one dummy 0x00 byte to the LZMA decoder since that
// is what it expects the first byte to be.
const uint8_t dummy_in = 0;