Use Working Ctx Logs when not in DMS Mode

We pre-hash the ptr for the dict match state sometimes. When that actually
happens, a hashlog of 0 can produce undefined behavior (right shift a long
long by 64). Only applies to unoptimized compilations, since when
optimizations are applied, those hash operations are dropped when we're not
actually in dms mode.
This commit is contained in:
W. Felix Handte
2018-09-28 17:12:54 -07:00
parent c38acff94f
commit bad74c4781
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -90,9 +90,9 @@ size_t ZSTD_compressBlock_doubleFast_generic(
prefixLowestIndex - (U32)(dictEnd - dictBase) :
0;
const U32 dictHBitsL = dictMode == ZSTD_dictMatchState ?
dictCParams->hashLog : 0;
dictCParams->hashLog : hBitsL;
const U32 dictHBitsS = dictMode == ZSTD_dictMatchState ?
dictCParams->chainLog : 0;
dictCParams->chainLog : hBitsS;
const U32 dictAndPrefixLength = (U32)(ip - prefixLowest + dictEnd - dictStart);
assert(dictMode == ZSTD_noDict || dictMode == ZSTD_dictMatchState);