From: Nick Terrell Date: Wed, 21 Mar 2018 23:20:30 +0000 (-0700) Subject: Fix broken assertion X-Git-Tag: v1.3.4~1^2~10^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad344033df0781c114e703d558a6e3dbac747fe5;p=thirdparty%2Fzstd.git 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. --- diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index c7b08cbce..c7a205d8c 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)