aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/comp/xz.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/xz.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/xz.c')
-rw-r--r--lib/sqfs/comp/xz.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqfs/comp/xz.c b/lib/sqfs/comp/xz.c
index 20e6445..662a49f 100644
--- a/lib/sqfs/comp/xz.c
+++ b/lib/sqfs/comp/xz.c
@@ -291,6 +291,12 @@ int xz_compressor_create(const sqfs_compressor_config_t *cfg,
if (cfg->opt.xz.level > SQFS_XZ_MAX_LEVEL)
return SQFS_ERROR_UNSUPPORTED;
+ if (cfg->opt.xz.dict_size < SQFS_XZ_MIN_DICT_SIZE)
+ return SQFS_ERROR_UNSUPPORTED;
+
+ if (cfg->opt.xz.dict_size > SQFS_XZ_MAX_DICT_SIZE)
+ return SQFS_ERROR_UNSUPPORTED;
+
xz = calloc(1, sizeof(*xz));
base = (sqfs_compressor_t *)xz;
if (xz == NULL)