aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lz/lz_encoder.c
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-05-08 22:58:09 +0800
committerJia Tan <jiat0218@gmail.com>2023-05-11 22:28:45 +0800
commitd0f33d672a4da7985ebb5ba8d829f885de49c171 (patch)
tree0200c537d23be7b4ad1f60ccd70574026b26f73a /src/liblzma/lz/lz_encoder.c
parentAdd NEWS for 5.4.3. (diff)
downloadxz-d0f33d672a4da7985ebb5ba8d829f885de49c171.tar.xz
liblzma: Creates IS_ENC_DICT_SIZE_VALID() macro.
This creates an internal liblzma macro to test if the dictionary size is valid for encoding.
Diffstat (limited to 'src/liblzma/lz/lz_encoder.c')
-rw-r--r--src/liblzma/lz/lz_encoder.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/liblzma/lz/lz_encoder.c b/src/liblzma/lz/lz_encoder.c
index 5489085a..8e724a03 100644
--- a/src/liblzma/lz/lz_encoder.c
+++ b/src/liblzma/lz/lz_encoder.c
@@ -196,9 +196,7 @@ lz_encoder_prepare(lzma_mf *mf, const lzma_allocator *allocator,
// For now, the dictionary size is limited to 1.5 GiB. This may grow
// in the future if needed, but it needs a little more work than just
// changing this check.
- if (lz_options->dict_size < LZMA_DICT_SIZE_MIN
- || lz_options->dict_size
- > (UINT32_C(1) << 30) + (UINT32_C(1) << 29)
+ if (!IS_ENC_DICT_SIZE_VALID(lz_options->dict_size)
|| lz_options->nice_len > lz_options->match_len_max)
return true;