[FFmpeg-devel] [PATCH] A-pac demuxer and decoder

James Almer jamrial at gmail.com
Fri Sep 23 21:31:15 EEST 2022


On 9/21/2022 4:23 AM, Paul B Mahol wrote:
> Patches attached.

[...]

> +static av_cold int apac_close(AVCodecContext *avctx)
> +{
> +    APACContext *s = avctx->priv_data;
> +
> +    av_freep(&s->bitstream);
> +    s->bitstream_size = 0;
> +
> +    for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {

for (int ch = 0; ch < FF_ARRAY_ELEMS(s->ch); ch++)

As Andreas mentioned on IRC, this will crash if you try to initialize 
the decoder by setting more than 2 channels otherwise.

> +        ChContext *c = &s->ch[ch];
> +
> +        av_audio_fifo_free(c->samples);
> +    }
> +
> +    return 0;
> +}



More information about the ffmpeg-devel mailing list