[codec,ncrush] fix index out of bound check

This commit is contained in:
akallabeth 2024-04-16 20:50:36 +02:00 committed by akallabeth
parent 5301603548
commit 9d7c98f4d0

View File

@ -2511,7 +2511,7 @@ static int ncrush_move_encoder_windows(NCRUSH_CONTEXT* ncrush, BYTE* HistoryPtr)
const size_t match_half = ARRAYSIZE(ncrush->MatchTable) / 2;
for (size_t j = 0; j < match_half; j++)
{
if (HistoryOffset + j > ARRAYSIZE(ncrush->MatchTable))
if (HistoryOffset + j >= ARRAYSIZE(ncrush->MatchTable))
continue;
INT32 NewMatch = ncrush->MatchTable[HistoryOffset + j] - HistoryOffset;