[FFmpeg-cvslog] avcodec/cdgraphics: Check frame before clearing

Michael Niedermayer git at videolan.org
Sat Dec 5 01:11:45 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Dec  4 01:07:04 2020 +0100| [fef17e89283f8b72fc125cd066dce15a875802f6] | committer: Michael Niedermayer

avcodec/cdgraphics: Check frame before clearing

Fixes: null pointer dereference
Fixes: 27730/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-6212402236096512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fef17e89283f8b72fc125cd066dce15a875802f6
---

 libavcodec/cdgraphics.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index 965f43684a..263459d0f2 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -369,6 +369,9 @@ static void cdg_decode_flush(AVCodecContext *avctx)
 {
     CDGraphicsContext *cc = avctx->priv_data;
 
+    if (!cc->frame->data[0])
+        return;
+
     memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height);
     if (!avctx->frame_number)
         memset(cc->frame->data[1], 0, AVPALETTE_SIZE);



More information about the ffmpeg-cvslog mailing list