diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index fb1ce2cb06..ec8264e5f1 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -449,6 +449,10 @@ static int output_configure(AACContext *ac, int type = layout_map[i][0]; int id = layout_map[i][1]; id_map[type][id] = type_counts[type]++; + if (id_map[type][id] >= MAX_ELEM_ID) { + avpriv_request_sample(ac->avctx, "Remapped id too large\n"); + return AVERROR_PATCHWELCOME; + } } // Try to sniff a reasonable channel order, otherwise output the // channels in the order the PCE declared them.