On 3/21/2022 5:19 PM, Michael Niedermayer wrote:
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 <mich...@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;

Can't you just do

return (const AVCodec *)c;

Or is that aliasing a problem?

  }
static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to