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))))
ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr);
}
if (type != TYPE_CCE) {
+ if (*channels >= MAX_CHANNELS - 2)
+ return AVERROR_INVALIDDATA;
ac->output_element[(*channels)++] = &ac->che[type][id]->ch[0];
if (type == TYPE_CPE ||
(type == TYPE_SCE && ac->oc[1].m4ac.ps == 1)) {
int ms_present)
{
int idx;
+ int max_idx = cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb;
if (ms_present == 1) {
- for (idx = 0;
- idx < cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb;
- idx++)
+ for (idx = 0; idx < max_idx; idx++)
cpe->ms_mask[idx] = get_bits1(gb);
} else if (ms_present == 2) {
- memset(cpe->ms_mask, 1, cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb * sizeof(cpe->ms_mask[0]));
+ memset(cpe->ms_mask, 1, max_idx * sizeof(cpe->ms_mask[0]));
}
}