From patchwork Tue Feb 19 20:09:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 12106 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 C225F4481CE for ; Tue, 19 Feb 2019 22:10:59 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A795268A8FD; Tue, 19 Feb 2019 22:10:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-1.mx.upcmail.net (vie01a-qmta-pe01-1.mx.upcmail.net [62.179.121.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 12DCA68A6D5 for ; Tue, 19 Feb 2019 22:10:57 +0200 (EET) Received: from [172.31.218.46] (helo=vie01a-dmta-pe06-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1gwBjE-0005gU-Gx for ffmpeg-devel@ffmpeg.org; Tue, 19 Feb 2019 21:10:56 +0100 Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1gwBj9-0003Tp-1R for ffmpeg-devel@ffmpeg.org; Tue, 19 Feb 2019 21:10:51 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id wBiBgNCMX2WSswBiBgdud9; Tue, 19 Feb 2019 21:09:51 +0100 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=E7kcWpVl 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=pOxD74vGkRpgExGwAbcA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 19 Feb 2019 21:09:24 +0100 Message-Id: <20190219200924.3179-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219200924.3179-1-michael@niedermayer.cc> References: <20190219200924.3179-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfEnAM3BGL/SGwWDv3eD/uq9dKZKXRwh5IEclxNLnPjeslpQIaD4iy68cfAzeUmh318SmbtCX4+qvbDeAh4GJXuBxqSq7yKoZOexQE/uHxrz35GgVkzMJ rHK26wDmZHeaw+FpOgv7yYMA4zNNJqdNudm7P671cYsWLMRcIlIZHZJY Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/wcmv: Avoid copying frames if they are unchanged 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" Improves speed of the testcase by about a factor of 10 Fixes: Timeout Fixes: 13132/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WCMV_fuzzer-5664190616829952 Signed-off-by: Michael Niedermayer --- libavcodec/wcmv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c index f03761b343..2988c15b23 100644 --- a/libavcodec/wcmv.c +++ b/libavcodec/wcmv.c @@ -56,11 +56,13 @@ static int decode_frame(AVCodecContext *avctx, } bytestream2_init(&gb, avpkt->data, avpkt->size); + blocks = bytestream2_get_le16(&gb); + if (!blocks) + return avpkt->size; if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - blocks = bytestream2_get_le16(&gb); if (blocks > 5) { GetByteContext bgb; int x = 0, size;