From: W. Felix Handte Date: Fri, 4 Sep 2020 16:16:35 +0000 (-0400) Subject: Fix Bug: Only Use DDSS Insertion on CDict MatchStates X-Git-Tag: v1.4.7~81^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07793547e649e75452cbb426fb3df1c9b6e0235e;p=thirdparty%2Fzstd.git 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. --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index bec9afd79..3e253006a 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -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);