1
0
mirror of https://github.com/facebook/zstd.git synced 2025-03-07 01:10:04 +02:00

fix window update (#3556)

This commit is contained in:
daniellerozenblit 2023-03-21 13:28:26 -04:00 committed by GitHub
parent a3c3a38b9b
commit 3e0550ee52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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