diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 37c7de5e90..f60060adb5 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -148,6 +148,8 @@ static av_cold int che_configure(AACContext *ac, enum ChannelPosition che_pos, int type, int id, int *channels) { + if (*channels >= MAX_CHANNELS) + return AVERROR_INVALIDDATA; if (che_pos) { if (!ac->che[type][id]) { if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))