diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2021-10-10 23:31:41 +0200 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2021-10-19 17:44:30 +0200 |
commit | a98a25408b0e9b0264abcc3dabfafd9ff2ea1046 (patch) | |
tree | 9b67658c6de1ee971ff72b27df6328028f027e6a /lib/xz/xz_dec_lzma2.c | |
parent | lib/xz: Validate the value before assigning it to an enum variable (diff) | |
download | linux-a98a25408b0e9b0264abcc3dabfafd9ff2ea1046.tar.xz linux-a98a25408b0e9b0264abcc3dabfafd9ff2ea1046.zip |
lib/xz: Move s->lzma.len = 0 initialization to lzma_reset()
It's a more logical place even if the resetting needs to be done
only once per LZMA2 stream (if lzma_reset() called in the middle
of an LZMA2 stream, .len will already be 0).
Link: https://lore.kernel.org/r/20211010213145.17462-4-xiang@kernel.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'lib/xz/xz_dec_lzma2.c')
-rw-r--r-- | lib/xz/xz_dec_lzma2.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c index d548cf0e59fe..22b789645ce5 100644 --- a/lib/xz/xz_dec_lzma2.c +++ b/lib/xz/xz_dec_lzma2.c @@ -791,6 +791,7 @@ static void lzma_reset(struct xz_dec_lzma2 *s) s->lzma.rep1 = 0; s->lzma.rep2 = 0; s->lzma.rep3 = 0; + s->lzma.len = 0; /* * All probabilities are initialized to the same value. This hack @@ -1174,8 +1175,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props) } } - s->lzma.len = 0; - s->lzma2.sequence = SEQ_CONTROL; s->lzma2.need_dict_reset = true; |