From 77ae664ba635e6f47998ed84459ae511fbe256e0 Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Tue, 16 Mar 2021 17:36:05 -0700 Subject: [PATCH] Fix ZSTD_dedicatedDictSearch_isSupported() requirements --- lib/compress/zstd_compress.c | 5 ++++- tests/playTests.sh | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 93c4075c..0232be04 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -5186,7 +5186,10 @@ static ZSTD_compressionParameters ZSTD_dedicatedDictSearch_getCParams(int const static int ZSTD_dedicatedDictSearch_isSupported( ZSTD_compressionParameters const* cParams) { - return (cParams->strategy >= ZSTD_greedy) && (cParams->strategy <= ZSTD_lazy2); + return (cParams->strategy >= ZSTD_greedy) + && (cParams->strategy <= ZSTD_lazy2) + && (cParams->hashLog >= cParams->chainLog) + && (cParams->chainLog <= 24); } /** diff --git a/tests/playTests.sh b/tests/playTests.sh index da0e67a3..2dfb4fa0 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -805,6 +805,8 @@ println "- Dictionary compression roundtrip" zstd -f tmp -D tmpDict zstd -d tmp.zst -D tmpDict -fo result $DIFF "$TESTFILE" result +println "- Dictionary compression with hlog < clog" +zstd -6f tmp -D tmpDict --zstd=clog=25,hlog=23 println "- Dictionary compression with btlazy2 strategy" zstd -f tmp -D tmpDict --zstd=strategy=6 zstd -d tmp.zst -D tmpDict -fo result