Skip to content

Commit 2e02596

Browse files
committed
CR fixes
1 parent e18c951 commit 2e02596

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/compress/zstd_compress.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,12 +1935,15 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms,
19351935
if (ZSTD_rowMatchFinderUsed(cParams->strategy, useRowMatchFinder)) {
19361936
/* Row match finder needs an additional table of hashes ("tags") */
19371937
size_t const tagTableSize = hSize * sizeof(U16);
1938-
ms->tagTable = (U16 *) ZSTD_cwksp_reserve_aligned_init_once(ws, tagTableSize);
19391938
/* We want to generate a new salt in case we reset a Cctx, but we always want to use
19401939
* 0 when we reset a Cdict */
19411940
if(forWho == ZSTD_resetTarget_CCtx) {
1941+
ms->tagTable = (U16 *) ZSTD_cwksp_reserve_aligned_init_once(ws, tagTableSize);
19421942
ms->hashSalt = ms->hashSalt * 6364136223846793005 + 1; /* based on MUSL rand */
19431943
} else {
1944+
/* When we are not salting we want to always memset the memory */
1945+
ms->tagTable = (U16 *) ZSTD_cwksp_reserve_aligned(ws, tagTableSize);
1946+
ZSTD_memset(ms->tagTable, 0, tagTableSize);
19441947
ms->hashSalt = 0;
19451948
}
19461949
{ /* Switch to 32-entry rows if searchLog is 5 (or more) */

lib/compress/zstd_compress_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ size_t ZSTD_hashPtrSalted(const void* p, U32 hBits, U32 mls, const U64 hashSalt)
845845
switch(mls)
846846
{
847847
default:
848-
case 4: return ZSTD_hash4PtrS(p, hBits, (U32)hashSalt);
848+
case 4: return ZSTD_hash4PtrS(p, hBits, (U32)(hashSalt >> 32));
849849
case 5: return ZSTD_hash5PtrS(p, hBits, hashSalt);
850850
case 6: return ZSTD_hash6PtrS(p, hBits, hashSalt);
851851
case 7: return ZSTD_hash7PtrS(p, hBits, hashSalt);

0 commit comments

Comments
 (0)