Fix Bug: Only Use DDSS Insertion on CDict MatchStates

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.
This commit is contained in:
W. Felix Handte 2020-09-04 12:16:35 -04:00
parent d214d8c859
commit 07793547e6

View 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);