From patchwork Mon Oct 30 22:21:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 5767 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp3209128jah; Mon, 30 Oct 2017 15:22:00 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QPHYgs1HY7lLbQkolla4+q57PHFEzwFKubey89h0FhtiNkz9gy5oOMZBl5/IhpsEJjfeK+ X-Received: by 10.223.145.165 with SMTP id 34mr7965776wri.140.1509402120082; Mon, 30 Oct 2017 15:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509402120; cv=none; d=google.com; s=arc-20160816; b=dHfOA4/prC4N8lFPKqnXgm6MS11QM3pEuuIZzsVEfLHx8IE2dKQ+idphFzovezHPhn 5RPVA+ftnrQzgXDHSYlNKqjx2c4jz/Bpuq9vGqgxBkXxjLVttsGfaWXjIfc4WhXaZEfo Pq98mAGl5+IygTHj1+FCOdbsO3xiWnRFL6W9FbRjAgsR3cy24nMN5djHhNpImcmMCYU9 9lkeIGcncucCnIQNubFltPjwy4nrQhTJY8Upa/tVmVz3w4CJ5qOEH8d3MMsnGWA8aruK udSpQ/Tj+RcMqIlj8XsgDsimTY4TYUT2xZIApyjea0FFj/m3Iml3S2eD3/33EdKtbmmb tHrw== 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=V5iw7R9E2NL2cO7Qrn4lLNsToyFINUoJ8CB/y1cCJ/M=; b=A9Xh2DAxASSFlg8nSpuU2XyL/XiTilemStYZK8SYvIbUcDP2XWQD330Gf23FIEMRo1 lVtkzybL9YHqpdK2h6B+eRXEyB/6KHc9RO0bb9ZA7Nx322ReWME4QzuQcvumtKr7mMiK zNfPNwiPD0FJquX6UwzoCwVpYinI86kBGkfne6NYtk/iWQRob+E57nDuqn95un5xt1m/ ed+GPJiVO2WSXRd/1Hze2ZKnl1e5vP4wbF2XQrXLLabpZq2MLB8AEO/mtu8AjbKZSG26 lqwzs9XRpHG9KprxdNmbgeuUlH2oejb7xf60pnVDnYzI3AFUShZ06FE0LDh3h2O/utpz COKg== 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 x24si6943584wrd.436.2017.10.30.15.21.59; Mon, 30 Oct 2017 15:22:00 -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 3DE16689D46; Tue, 31 Oct 2017 00:21:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-2.mx.upcmail.net (vie01a-dmta-pe08-2.mx.upcmail.net [84.116.36.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8AE2C689D3A for ; Tue, 31 Oct 2017 00:21:42 +0200 (EET) 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 1e9IRL-0008Od-S6 for ffmpeg-devel@ffmpeg.org; Mon, 30 Oct 2017 23:21:51 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id TyMj1w01Q0S5wYM01yMk7x; Mon, 30 Oct 2017 23:21:44 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 30 Oct 2017 23:21:41 +0100 Message-Id: <20171030222141.18537-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171030222141.18537-1-michael@niedermayer.cc> References: <20171030222141.18537-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/h264idct_template: Fix integer overflows in ff_h264_idct8_add() 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" Fixes: runtime error: signed integer overflow: 924846844 + 1457520640 cannot be represented in type 'int' Fixes: 3416/clusterfuzz-testcase-minimized-6125587682820096 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/h264idct_template.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c index 3ad58c4a11..fbd07cb8d5 100644 --- a/libavcodec/h264idct_template.c +++ b/libavcodec/h264idct_template.c @@ -107,10 +107,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){ } for( i = 0; i < 8; i++ ) { - const unsigned a0 = block[0+i*8] + block[4+i*8]; - const unsigned a2 = block[0+i*8] - block[4+i*8]; - const unsigned a4 = (block[2+i*8]>>1) - block[6+i*8]; - const unsigned a6 = (block[6+i*8]>>1) + block[2+i*8]; + const unsigned a0 = block[0+i*8] + (unsigned)block[4+i*8]; + const unsigned a2 = block[0+i*8] - (unsigned)block[4+i*8]; + const unsigned a4 = (block[2+i*8]>>1) - (unsigned)block[6+i*8]; + const unsigned a6 = (block[6+i*8]>>1) + (unsigned)block[2+i*8]; const unsigned b0 = a0 + a6; const unsigned b2 = a2 + a4;