aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-12-26 18:18:36 -0800
committerandroid-build-merger <android-build-merger@google.com>2018-12-26 18:18:36 -0800
commitca0d8e7461269c6d169aa70086ef8f26f43bcc90 (patch)
treeb01d9477e78db0e42e513ec5634268f17bf4a51d
parenta98beef0cf4e9887d179bf3725c8ea77c1b11b86 (diff)
parent4899e80a1725d07d028df4610e39b0c278a6252a (diff)
downloadfdk-aac-ca0d8e7461269c6d169aa70086ef8f26f43bcc90.tar.gz
fdk-aac-ca0d8e7461269c6d169aa70086ef8f26f43bcc90.tar.bz2
fdk-aac-ca0d8e7461269c6d169aa70086ef8f26f43bcc90.zip
Merge "Unsigned Integer Overflow in InitSegmentBitfield()"
am: 4899e80a17 Change-Id: I4cb328300795db2c02b5d4ab01f5e4c4aecd0117
-rw-r--r--libAACdec/src/aacdec_hcrs.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libAACdec/src/aacdec_hcrs.cpp b/libAACdec/src/aacdec_hcrs.cpp
index 1d5aa27..d2bc867 100644
--- a/libAACdec/src/aacdec_hcrs.cpp
+++ b/libAACdec/src/aacdec_hcrs.cpp
@@ -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