From patchwork Fri May 17 22:27:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 13187 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6DD02446292 for ; Sat, 18 May 2019 01:28:42 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4AFD868A646; Sat, 18 May 2019 01:28:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-3.mx.upcmail.net (vie01a-dmta-pe07-3.mx.upcmail.net [84.116.36.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 39638689D73 for ; Sat, 18 May 2019 01:28:34 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.91) (envelope-from ) id 1hRlL8-0000Ww-29 for ffmpeg-devel@ffmpeg.org; Sat, 18 May 2019 00:28:34 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id RlK9h1LNZ5D5NRlK9hMW3j; Sat, 18 May 2019 00:27:33 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=bu8y+3Si c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=eHiF9wlhQa-51OB2HA0A:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=pHzHmUro8NiASowvMSCR:22 a=nt3jZW36AmriUCFCBwmW:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 18 May 2019 00:27:32 +0200 Message-Id: <20190517222733.20113-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfOvUavZeVuz5GDX7GpL3amKbpL6PdF7HM3LBCDGTyvR/2FDnfSCo3iqX/t1hv5WFOM/8PtviOKem8gfugoA0p7bpHWZyfwQNVmheciDrqtJ9A8IJgj/R 0ohVA0jwhMrHXVUQ5AHgUPXiCdlNzxSj3WzNNP7b2up9ZYAvz7VZqCXx Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/pafvideo: Clear frame buffer later 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This way the clearing can be skipped in case of some errors. Fixes: Timeout (11sec -> 344ms) Fixes: 14670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5769534503387136 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/pafvideo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/pafvideo.c b/libavcodec/pafvideo.c index 7bfd6815df..323c662c59 100644 --- a/libavcodec/pafvideo.c +++ b/libavcodec/pafvideo.c @@ -293,9 +293,6 @@ static int paf_video_decode(AVCodecContext *avctx, void *data, return ret; if (code & 0x20) { // frame is keyframe - for (i = 0; i < 4; i++) - memset(c->frame[i], 0, c->frame_size); - memset(c->pic->data[1], 0, AVPALETTE_SIZE); c->current_frame = 0; c->pic->key_frame = 1; @@ -332,6 +329,10 @@ static int paf_video_decode(AVCodecContext *avctx, void *data, c->pic->palette_has_changed = 1; } + if (code & 0x20) + for (i = 0; i < 4; i++) + memset(c->frame[i], 0, c->frame_size); + switch (code & 0x0F) { case 0: /* Block-based motion compensation using 4x4 blocks with either