]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix Bug: Only Use DDSS Insertion on CDict MatchStates 2276/head
authorW. Felix Handte <w@felixhandte.com>
Fri, 4 Sep 2020 16:16:35 +0000 (12:16 -0400)
committerW. Felix Handte <w@felixhandte.com>
Thu, 10 Sep 2020 22:51:52 +0000 (18:51 -0400)
Previously, if DDSS was enabled on a CCtx and a dictionary was inserted into
the CCtx, the CCtx MatchState would be filled as a DDSS struct, causing
segfaults etc. This changes the check to use whether the MatchState is marked
as using the DDSS (which is only ever set for CDict MatchStates), rather than
looking at the CCtxParams.

lib/compress/zstd_compress.c

index bec9afd79526907da0ee5c98a5d0d0034d0413cd..3e253006ae6b48f00f7815cc010cb8cbaca8a43e 100644 (file)
@@ -2914,7 +2914,7 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,
         case ZSTD_greedy:
         case ZSTD_lazy:
         case ZSTD_lazy2:
-            if (chunk >= HASH_READ_SIZE && params->enableDedicatedDictSearch)
+            if (chunk >= HASH_READ_SIZE && ms->dedicatedDictSearch)
                 ZSTD_dedicatedDictSearch_lazy_loadDictionary(ms, ichunk-HASH_READ_SIZE);
             else if (chunk >= HASH_READ_SIZE)
                 ZSTD_insertAndFindFirstIndex(ms, ichunk-HASH_READ_SIZE);