[coverity] 1543052 Out-of-bounds read

This commit is contained in:
akallabeth 2024-04-11 12:55:17 +02:00 committed by Martin Fleisz
parent 285bea320d
commit 6241ce5674

View File

@ -2119,7 +2119,7 @@ int ncrush_decompress(NCRUSH_CONTEXT* ncrush, const BYTE* pSrcData, UINT32 SrcSi
CopyOffset = ncrush->OffsetCache[OffsetCacheIndex];
const UINT16 Mask = get_word(&HuffTableMask[21]);
const UINT32 MaskedBits = bits & Mask;
if (MaskedBits > ARRAYSIZE(HuffTableLOM))
if (MaskedBits >= ARRAYSIZE(HuffTableLOM))
return -1;
LengthOfMatch = HuffTableLOM[MaskedBits] & 0xFFF;
BitLength = HuffTableLOM[MaskedBits] >> 12;