]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix ZSTD_dedicatedDictSearch_isSupported() requirements 2540/head
authorSen Huang <senhuang96@fb.com>
Wed, 17 Mar 2021 00:36:05 +0000 (17:36 -0700)
committerSen Huang <senhuang96@fb.com>
Wed, 17 Mar 2021 00:36:05 +0000 (17:36 -0700)
lib/compress/zstd_compress.c
tests/playTests.sh

index 93c4075c521eff275788bfed8452b38a8529db29..0232be0448d760a5701b95c3327a590432954b7c 100644 (file)
@@ -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);
 }
 
 /**
index da0e67a35b8018b6495e863c554b17774ed92596..2dfb4fa07ac65f51501f6d97d8ef8bd930f38eca 100755 (executable)
@@ -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