avcodec/allcodecs: Dont play with NULLs

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
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-03-21 21:19:43 +01:00
parent 4fdfe430c1
commit dd1ce72e68
1 changed files with 4 additions and 3 deletions

View File

@ -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)