Always check whether given channel config is supported.

Bug: 112660981
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: I169161dd31bc624f2cab6be2b4c6518946ed32ba
Merged-In: I169161dd31bc624f2cab6be2b4c6518946ed32ba
This commit is contained in:
Fraunhofer IIS FDK 2018-06-08 18:07:14 +02:00 committed by Jean-Michel Trivi
parent 42f714f2ab
commit 25b209f229
1 changed files with 3 additions and 11 deletions

View File

@ -1630,18 +1630,10 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
aacChannelsOffset = 0;
aacChannelsOffsetIdx = 0;
elementOffset = 0;
if (configMode & AC_CM_ALLOC_MEM) {
if ((ascChannels <= 0) ||
if ((ascChannels <= 0) || (ascChannels > (8)) ||
(asc->m_channelConfiguration > AACDEC_MAX_CH_CONF)) {
return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
}
if ((ascChannels + aacChannelsOffsetIdx) > ((8) * 2)) {
return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
}
if ((ascChannels + aacChannelsOffset) > (8)) {
return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
}
}
/* Set syntax flags */
self->flags[streamIndex] = 0;