Commit d134b8d8 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/cdgraphics: Clear first frame only once

frame_number will not increase if nothing is output

Fixes: Timeout
Fixes: 9057/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-4844661498707968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent d2015e6b
...@@ -69,6 +69,7 @@ typedef struct CDGraphicsContext { ...@@ -69,6 +69,7 @@ typedef struct CDGraphicsContext {
int hscroll; int hscroll;
int vscroll; int vscroll;
int transparency; int transparency;
int cleared;
} CDGraphicsContext; } CDGraphicsContext;
static av_cold int cdg_decode_init(AVCodecContext *avctx) static av_cold int cdg_decode_init(AVCodecContext *avctx)
...@@ -287,9 +288,10 @@ static int cdg_decode_frame(AVCodecContext *avctx, ...@@ -287,9 +288,10 @@ static int cdg_decode_frame(AVCodecContext *avctx,
if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0) if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0)
return ret; return ret;
if (!avctx->frame_number) { if (!cc->cleared) {
memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height); memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height);
memset(cc->frame->data[1], 0, AVPALETTE_SIZE); memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
cc->cleared = 1;
} }
command = bytestream2_get_byte(&gb); command = bytestream2_get_byte(&gb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment