[FFmpeg-devel] [PATCH] avcodec: validate codec parameters in avcodec_parameters_to_context

wm4 nfxjfg at googlemail.com
Tue Oct 25 15:39:38 EEST 2016

On Tue, 25 Oct 2016 09:47:29 +0200
Hendrik Leppkes <h.leppkes at gmail.com> wrote:

> On Tue, Oct 25, 2016 at 1:50 AM, Andreas Cadhalpun
> <andreas.cadhalpun at googlemail.com> wrote:
> > This should reduce the impact of a demuxer (or API user) setting bogus
> > codec parameters.
> >
> >  
> This seems rather noisy and doesn't really solve anything, does it?
> Decoders still need to validate values instead of blindly trusting
> them, and this just hides some problems in these decoders, instead of
> fixing them there. API users of avcodec would not fill
> AVCodecParameters, they would fill a codec context directly.

You could also argue that the demuxer shouldn't return invalid
parameters either.

How about this: always convert the params to a temporary codecpar, and
provide a function to determine the validity of a codecpar. This way
the check could be done in multiple places without duplicating the code
needed for it.

More information about the ffmpeg-devel mailing list