1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2020-12-04 01:07:04 +01:00
parent 4f66dd13d0
commit fef17e8928

View File

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