Don't Attach Empty Dict Contents
In weird corner cases, they produce unexpected results...dev
parent
9c92223468
commit
582b7f85ed
|
@ -1227,6 +1227,10 @@ static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,
|
|||
}
|
||||
|
||||
if (attachDict) {
|
||||
if (cdict->matchState.window.nextSrc - cdict->matchState.window.base == 0) {
|
||||
/* don't even attach dictionaries with no contents */
|
||||
DEBUGLOG(4, "skipping attaching empty dictionary");
|
||||
} else {
|
||||
DEBUGLOG(4, "attaching dictionary into context");
|
||||
cctx->blockState.matchState.dictMatchState = &cdict->matchState;
|
||||
|
||||
|
@ -1241,6 +1245,7 @@ static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,
|
|||
ZSTD_window_clear(&cctx->blockState.matchState.window);
|
||||
}
|
||||
cctx->blockState.matchState.loadedDictEnd = cctx->blockState.matchState.window.dictLimit;
|
||||
}
|
||||
} else {
|
||||
DEBUGLOG(4, "copying dictionary into context");
|
||||
/* copy tables */
|
||||
|
|
Loading…
Reference in New Issue