[FFmpeg-devel] [PATCH 2/5] avcodec/allcodecs: Dont play with NULLs

Michael Niedermayer michael at niedermayer.cc
Mon Mar 21 23:03:58 EET 2022


On Mon, Mar 21, 2022 at 09:48:40PM +0100, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: member access within null pointer of type 'const FFCodec' (aka 'const struct FFCodec')
> > Fixes: 45726/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554445419249664
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/allcodecs.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > index b1aa7e266b..22d56760ec 100644
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -882,10 +882,11 @@ const AVCodec *av_codec_iterate(void **opaque)
> >  
> >      ff_thread_once(&av_codec_static_init, av_codec_init_static);
> >  
> > -    if (c)
> > +    if (c) {
> >          *opaque = (void*)(i + 1);
> > -
> > -    return &c->p;
> > +        return &c->p;
> > +    }
> > +    return NULL;
> >  }
> >  
> >  static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
> 
> LGTM.

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220321/786ad0ce/attachment.sig>


More information about the ffmpeg-devel mailing list