mirror of
https://github.com/facebook/zstd.git
synced 2025-10-05 00:07:15 -04:00
[fuzz] msan uninitialized unsigned value (#1908)
Fixes new fuzz issue Credit to OSS-Fuzz * Initializing unsigned value * Initialilzing to 1 instead of 0 because its more conservative * Unconditionoally setting to check first and then checking zero * Moving bool to before block for c90 * Move check set before block
This commit is contained in:
parent
5120883a9c
commit
49c6d49247
@ -2858,9 +2858,10 @@ size_t ZSTD_loadCEntropy(ZSTD_compressedBlockState_t* bs, void* workspace,
|
||||
const BYTE* dictPtr = (const BYTE*)dict; /* skip magic num and dict ID */
|
||||
const BYTE* const dictEnd = dictPtr + dictSize;
|
||||
dictPtr += 8;
|
||||
bs->entropy.huf.repeatMode = HUF_repeat_check;
|
||||
|
||||
{ unsigned maxSymbolValue = 255;
|
||||
unsigned hasZeroWeights;
|
||||
unsigned hasZeroWeights = 1;
|
||||
size_t const hufHeaderSize = HUF_readCTable((HUF_CElt*)bs->entropy.huf.CTable, &maxSymbolValue, dictPtr,
|
||||
dictEnd-dictPtr, &hasZeroWeights);
|
||||
|
||||
@ -2868,7 +2869,6 @@ size_t ZSTD_loadCEntropy(ZSTD_compressedBlockState_t* bs, void* workspace,
|
||||
* weights. Otherwise, we set it to check */
|
||||
if (!hasZeroWeights)
|
||||
bs->entropy.huf.repeatMode = HUF_repeat_valid;
|
||||
else bs->entropy.huf.repeatMode = HUF_repeat_check;
|
||||
|
||||
RETURN_ERROR_IF(HUF_isError(hufHeaderSize), dictionary_corrupted);
|
||||
RETURN_ERROR_IF(maxSymbolValue < 255, dictionary_corrupted);
|
||||
|
Loading…
x
Reference in New Issue
Block a user