aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma2_encoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-12-09 17:41:49 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-12-09 17:41:49 +0200
commit6efa2d80d46a38861016f41f0eb6fa2ec9260fe6 (patch)
tree273fe3b80c262d99c024b5de74b9b45783358319 /src/liblzma/lzma/lzma2_encoder.c
parentUpdated THANKS. (diff)
downloadxz-6efa2d80d46a38861016f41f0eb6fa2ec9260fe6.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--src/liblzma/lzma/lzma2_encoder.c5
1 files changed, 4 insertions, 1 deletions
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;