[FFmpeg-devel] [PATCH 2/4] avcodec/cbs: Check ctx for NULL in ff_cbs_flush()

Michael Niedermayer michael at niedermayer.cc
Sat Oct 29 22:13:51 EEST 2022


Fixes: null pointer dereference
Fixes: 52155/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-5760107527143424

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/cbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 504197e06d..9d59403f13 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -120,7 +120,7 @@ av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr,
 
 av_cold void ff_cbs_flush(CodedBitstreamContext *ctx)
 {
-    if (ctx->codec->flush)
+    if (ctx && ctx->codec->flush)
         ctx->codec->flush(ctx);
 }
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list