Add loop abort criterion to prevent timeout in EldSpecificConfig_Parse().

Bug: 145668344
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: Iea6457e8545438c7ad4d05a682ffa656ec35ead9
This commit is contained in:
Fraunhofer IIS FDK 2019-10-29 13:06:56 +01:00 committed by Jean-Michel Trivi
parent 089d368ddb
commit 24171ed080
1 changed files with 7 additions and 5 deletions

View File

@ -1325,9 +1325,9 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc,
CSTpCallBacks *cb) {
TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK;
CSEldSpecificConfig *esc = &asc->m_sc.m_eldSpecificConfig;
ASC_ELD_EXT_TYPE eldExtType;
UINT eldExtType;
int eldExtLen, len, cnt, ldSbrLen = 0, eldExtLenSum, numSbrHeader = 0,
sbrIndex;
sbrIndex, eldExtCnt = 0;
unsigned char downscale_fill_nibble;
@ -1394,9 +1394,8 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc,
eldExtLenSum = FDKgetValidBits(hBs);
esc->m_downscaledSamplingFrequency = asc->m_samplingFrequency;
/* parse ExtTypeConfigData */
while (
((eldExtType = (ASC_ELD_EXT_TYPE)FDKreadBits(hBs, 4)) != ELDEXT_TERM) &&
((INT)FDKgetValidBits(hBs) >= 0)) {
while (((eldExtType = FDKreadBits(hBs, 4)) != ELDEXT_TERM) &&
((INT)FDKgetValidBits(hBs) >= 0) && (eldExtCnt++ < 15)) {
eldExtLen = len = FDKreadBits(hBs, 4);
if (len == 0xf) {
len = FDKreadBits(hBs, 8);
@ -1455,6 +1454,9 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc,
break;
}
}
if (eldExtType != ELDEXT_TERM) {
return TRANSPORTDEC_PARSE_ERROR;
}
if ((INT)FDKgetValidBits(hBs) < 0) {
return TRANSPORTDEC_PARSE_ERROR;