summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-07-15 14:12:56 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-07-23 02:58:38 +0200
commitd134b8d85f5e8d1b0778d62455c2e80d5b2e8d66 (patch)
tree044ccca96bdc31d876e048b95a2465a3f3e3879d
parentd2015e6b86d717fbedb313481145355130bd3567 (diff)
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/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/cdgraphics.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index 87ad5e79f4..be85e54288 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -69,6 +69,7 @@ typedef struct CDGraphicsContext {
int hscroll;
int vscroll;
int transparency;
+ int cleared;
} CDGraphicsContext;
static av_cold int cdg_decode_init(AVCodecContext *avctx)
@@ -287,9 +288,10 @@ static int cdg_decode_frame(AVCodecContext *avctx,
if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0)
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[1], 0, AVPALETTE_SIZE);
+ cc->cleared = 1;
}
command = bytestream2_get_byte(&gb);