Merge "Unsigned Integer Overflow in InitSegmentBitfield()" am: 4899e80a17 am: ca0d8e7461

am: cafc42b5eb

Change-Id: Icd717282e22dfb01b678836f0a50eb9b56db9f0f
This commit is contained in:
Jean-Michel Trivi 2018-12-26 18:53:44 -08:00 committed by android-build-merger
commit 437b7440d1
1 changed files with 4 additions and 1 deletions

View File

@ -367,7 +367,10 @@ static UINT InitSegmentBitfield(UINT *pNumSegment,
UINT tempWord;
USHORT numValidSegment;
*pNumWordForBitfield = ((*pNumSegment - 1) >> THIRTYTWO_LOG_DIV_TWO_LOG) + 1;
*pNumWordForBitfield =
(*pNumSegment == 0)
? 0
: ((*pNumSegment - 1) >> THIRTYTWO_LOG_DIV_TWO_LOG) + 1;
/* loop over all words, which are completely used or only partial */
/* bit in pSegmentBitfield is zero if segment is empty; bit in