From ad344033df0781c114e703d558a6e3dbac747fe5 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 21 Mar 2018 16:20:30 -0700 Subject: [PATCH] Fix broken assertion The `avgJobSize` must not be lower than 256 KB for single-pass mode. In `zstd.h` we say the minimum value for `ZSTD_p_jobSize` is 1 MB, so ensure that we always pick a size >= 1 MB. Found by libFuzzer fuzzer tests with large input limits. --- lib/compress/zstdmt_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index c7b08cbc..c7a205d8 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -1029,7 +1029,7 @@ static size_t ZSTDMT_computeTargetJobLog(ZSTD_CCtx_params const params) { if (params.ldmParams.enableLdm) return MAX(21, params.cParams.chainLog + 4); - return params.cParams.windowLog + 2; + return MAX(20, params.cParams.windowLog + 2); } static size_t ZSTDMT_computeOverlapLog(ZSTD_CCtx_params const params)