diff options
Diffstat (limited to 'lib/sqfs/comp/zstd.c')
-rw-r--r-- | lib/sqfs/comp/zstd.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c index 81e369b..b2e5d8b 100644 --- a/lib/sqfs/comp/zstd.c +++ b/lib/sqfs/comp/zstd.c @@ -51,12 +51,15 @@ static int zstd_read_options(sqfs_compressor_t *base, sqfs_file_t *file) return 0; } -static ssize_t zstd_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in, - size_t size, sqfs_u8 *out, size_t outsize) +static sqfs_s32 zstd_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in, + sqfs_u32 size, sqfs_u8 *out, sqfs_u32 outsize) { zstd_compressor_t *zstd = (zstd_compressor_t *)base; size_t ret; + if (size >= 0x7FFFFFFF) + return 0; + ret = ZSTD_compressCCtx(zstd->zctx, out, outsize, in, size, zstd->level); @@ -66,12 +69,15 @@ static ssize_t zstd_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in, return ret < size ? ret : 0; } -static ssize_t zstd_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in, - size_t size, sqfs_u8 *out, size_t outsize) +static sqfs_s32 zstd_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in, + sqfs_u32 size, sqfs_u8 *out, sqfs_u32 outsize) { size_t ret; (void)base; + if (outsize >= 0x7FFFFFFF) + return 0; + ret = ZSTD_decompress(out, outsize, in, size); if (ZSTD_isError(ret)) |