From patchwork Sun Jul 15 13:13:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9729 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1354743jad; Sun, 15 Jul 2018 06:14:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdZere6DdGfc9dYDf7k5Y14pqccF5SzmWlRJBOAIF5pjW35fv9fvh1bJCvWooKNzM0N3YmN X-Received: by 2002:a1c:cbc1:: with SMTP id b184-v6mr3540223wmg.149.1531660485770; Sun, 15 Jul 2018 06:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531660485; cv=none; d=google.com; s=arc-20160816; b=rHhyv2bEG1Vip76/s//whggM6cPyQyPuJfo2iur4nG3g3D402lIO134k1HE0sluFxo 7vLRsxAIA6sl12mih5Nm2OD6N2GGH2UESUHS637VNREMEYWmngPydj+ehMcYwFpDRhRa 25evR45dioQYvN1e6fVpQLaTyyd2Qv7jzCFapbj8KNhu+Hi47wfsUjIepWk6FVxHxKfp kJrzRQXL1nZx3ioruVEPBDO27kjRGWODPBtEVhfSLM1IjnYA2eOpP4l/U1EzcjDH+qX8 s1go3KgXYjPXwtl/P4uQHzZuOah9G82bEkueD4arLt+QZtbL7IWQfSZUlIIfWIy17J5m RMiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=3fjfvwhrcHUFeZHDZS8EytmaeaNgth0DbEnA06oXDDc=; b=mlZl9ynJtu6LcIfpUNNJncJ3bi5egFBsEZra9FImsbRoxyIpMMtbmU6JFcHTCBmid9 FuDrYWoQvNVMGSV4NkeOSfwMGf6Uny7MNMMP+8TaVgzOtlGrwSQZyA/Zh/WjJqCgV6qL XuTVhLr1BV7VsSRledRb0bQuzwFkORi0Rv+dI+DXNEMJMp8i3Nz1lbuFTMcmCCdKlx/y qFe01EyWVwga2DcfjRmcnGo1naWu+B9+dfq9S+Loo24tj5eme+/9cSw9e4q90IQXElRt 1MET/QhrQ9mrSbJ5Z2v4kDK10YcH3wrKTT0fBZoEoWZ0krWei32Dzu1w5x2oaFAfn4OP 3QWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v15-v6si25029621wru.385.2018.07.15.06.14.45; Sun, 15 Jul 2018 06:14:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 278B668A61C; Sun, 15 Jul 2018 16:14:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-2.mx.upcmail.net (vie01a-qmta-pe01-2.mx.upcmail.net [62.179.121.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1C1F1689957 for ; Sun, 15 Jul 2018 16:13:59 +0300 (EEST) Received: from [172.31.218.54] (helo=vie01a-dmta-pe08-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fegqm-0003FF-3e for ffmpeg-devel@ffmpeg.org; Sun, 15 Jul 2018 15:14:08 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fegqg-0006ki-RH for ffmpeg-devel@ffmpeg.org; Sun, 15 Jul 2018 15:14:02 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id B1Dt1y0140S5wYM011DuT0; Sun, 15 Jul 2018 15:13:54 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 15 Jul 2018 15:13:41 +0200 Message-Id: <20180715131341.28705-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180715131341.28705-1-michael@niedermayer.cc> References: <20180715131341.28705-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/cdgraphics: Clear first frame only once X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 --- libavcodec/cdgraphics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);