summaryrefslogtreecommitdiff
path: root/libavcodec/cdgraphics.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-12-04 01:07:04 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-12-05 00:08:33 +0100
commitfef17e89283f8b72fc125cd066dce15a875802f6 (patch)
tree2905ec1eb5a9bcefcff5cc7d1c38535b3cb3ca5b /libavcodec/cdgraphics.c
parent4f66dd13d08d063e2748d172239df595078ff624 (diff)
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@khirnov.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/cdgraphics.c')
-rw-r--r--libavcodec/cdgraphics.c3
1 files changed, 3 insertions, 0 deletions
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);