]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix window update (#3556)
authordaniellerozenblit <48103643+daniellerozenblit@users.noreply.github.com>
Tue, 21 Mar 2023 17:28:26 +0000 (13:28 -0400)
committerGitHub <noreply@github.com>
Tue, 21 Mar 2023 17:28:26 +0000 (13:28 -0400)
lib/compress/zstd_compress.c

index a475f0c4a72e66fa018810211190762e271c301a..d91f8006089425c1929d2fc5d5a0adf8a7370175 100644 (file)
@@ -4722,6 +4722,7 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,
         assert(ZSTD_window_isEmpty(ms->window));
         if (loadLdmDict) assert(ZSTD_window_isEmpty(ls->window));
     }
+    ZSTD_window_update(&ms->window, src, srcSize, /* forceNonContiguous */ 0);
 
     DEBUGLOG(4, "ZSTD_loadDictionaryContent(): useRowMatchFinder=%d", (int)params->useRowMatchFinder);
 
@@ -4733,7 +4734,7 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,
 
     /* If the dict is larger than we can reasonably index in our tables, only load the suffix. */
     if (params->cParams.strategy < ZSTD_btultra) {
-        U32 maxDictSize = 8U << MIN(MAX(params->cParams.hashLog, params->cParams.chainLog), 27);
+        U32 maxDictSize = 8U << MIN(MAX(params->cParams.hashLog, params->cParams.chainLog), 28);
         if (srcSize > maxDictSize) {
             ip = iend - maxDictSize;
             src = ip;
@@ -4741,7 +4742,7 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,
         }
     }
 
-    ZSTD_window_update(&ms->window, src, srcSize, /* forceNonContiguous */ 0);
+    ms->nextToUpdate = (U32)(ip - ms->window.base);
     ms->loadedDictEnd = params->forceWindow ? 0 : (U32)(iend - ms->window.base);
     ms->forceNonContiguous = params->deterministicRefPrefix;