From 6efa2d80d46a38861016f41f0eb6fa2ec9260fe6 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Tue, 9 Dec 2008 17:41:49 +0200 Subject: Make the memusage functions of LZMA1 and LZMA2 encoders to validate the filter options. Add missing validation to LZMA2 encoder when options are changed in the middle of encoding. --- src/liblzma/lzma/lzma2_encoder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/liblzma/lzma/lzma2_encoder.c') diff --git a/src/liblzma/lzma/lzma2_encoder.c b/src/liblzma/lzma/lzma2_encoder.c index 757b871d..46912c3f 100644 --- a/src/liblzma/lzma/lzma2_encoder.c +++ b/src/liblzma/lzma/lzma2_encoder.c @@ -182,6 +182,8 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, || coder->opt_cur.lp != coder->opt_new->lp || coder->opt_cur.pb != coder->opt_new->pb)) { // Options have been changed, copy them to opt_cur. + // These get validated as part of + // lzma_lzma_encoder_reset() below. coder->opt_cur.lc = coder->opt_new->lc; coder->opt_cur.lp = coder->opt_new->lp; coder->opt_cur.pb = coder->opt_new->pb; @@ -193,7 +195,8 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, } if (coder->need_state_reset) - lzma_lzma_encoder_reset(coder->lzma, &coder->opt_cur); + return_if_error(lzma_lzma_encoder_reset( + coder->lzma, &coder->opt_cur)); coder->uncompressed_size = 0; coder->compressed_size = 0; -- cgit v1.2.3