aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/comp/compressor.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-06-04 05:32:47 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-06-04 05:38:40 +0200
commit30597cc7c5d566f671c84c025de97cb1fc2d242e (patch)
tree985410632a31d952fb3430c001ed5e7780cf0e0b /lib/sqfs/comp/compressor.c
parent0f23f0396aede08a5d0c95d75b272f1b1787a365 (diff)
Strictly enfore min/max dictionary size in XZ & LZMA compressors
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/comp/compressor.c')
-rw-r--r--lib/sqfs/comp/compressor.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqfs/comp/compressor.c b/lib/sqfs/comp/compressor.c
index 521471d..ff7ce0c 100644
--- a/lib/sqfs/comp/compressor.c
+++ b/lib/sqfs/comp/compressor.c
@@ -173,6 +173,9 @@ int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg,
cfg->opt.xz.lc = SQFS_XZ_DEFAULT_LC;
cfg->opt.xz.lp = SQFS_XZ_DEFAULT_LP;
cfg->opt.xz.pb = SQFS_XZ_DEFAULT_PB;
+
+ if (block_size < SQFS_XZ_MIN_DICT_SIZE)
+ cfg->opt.xz.dict_size = SQFS_XZ_MIN_DICT_SIZE;
break;
case SQFS_COMP_LZMA:
flag_mask |= SQFS_COMP_FLAG_LZMA_ALL;
@@ -181,6 +184,9 @@ int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg,
cfg->opt.lzma.lc = SQFS_LZMA_DEFAULT_LC;
cfg->opt.lzma.lp = SQFS_LZMA_DEFAULT_LP;
cfg->opt.lzma.pb = SQFS_LZMA_DEFAULT_PB;
+
+ if (block_size < SQFS_LZMA_MIN_DICT_SIZE)
+ cfg->opt.lzma.dict_size = SQFS_LZMA_MIN_DICT_SIZE;
break;
case SQFS_COMP_LZ4:
flag_mask |= SQFS_COMP_FLAG_LZ4_ALL;