From patchwork Tue Aug 1 23:28:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4579 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp530466vsu; Tue, 1 Aug 2017 16:28:38 -0700 (PDT) X-Received: by 10.223.139.89 with SMTP id v25mr6698759wra.248.1501630117934; Tue, 01 Aug 2017 16:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501630117; cv=none; d=google.com; s=arc-20160816; b=yN69tKEAYNC+LuV9VuO8UQyMb/ZeUIKAOCOjkvpoHI7IeZkvXQpVeHpY269ZF1l4TB M2Yn6IwUa99UHI07EECIeOaGBDD/nlGrgzzYAqfoPwibEy38dr8+3gvISshBOSnqv8hv STXPwH1dcTpBWqFSCIq9D9l/bM/tytuuGPViNe+fjOTXZMmOyQsJiAFvLVD1kDLNKYi+ onv8Sfnp5kMhmK0vx//eTUenbRDRBpV9EYaFrW6XCyeYUu0LnAQ/Jv25Q6VDDuZ0Ceo9 G6LIJS/FLQJDm0iIKqXnyCUKQusVcu/CefBf0K0ZDfrF0khTwJZNYGnaBiQfkiTOMRH8 TPGw== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=kMtr8sX49hLFmdn0Sy2DLKIphbCg3nJXuc4XzcdsZaI=; b=QGFTt1Mq6o/B7Kc+han3iJvzWSSWZY8zYF1ZljuBiNzj3DjCN7f9VcwH8Ltl/NbPo0 k0vS0GuCm3CbNe2EfFlNFvz6P94BxT+WNWNKQ5xvx3rOM51pdeGKLyQD2/R3Pg5mhdSL i+C0VfxCHhMok0/WSf66Dj/I78Xv39F6G2qPecSYeofj8epQ/l1FEkbSJuS9NQIADaA9 vL53O4sg2UECenmFPlyYUevCSUWCbtYm7N7Om8rQoNVZVYrTjvvjB0wRd6O7qoCD0SgR 0ZMI48sKIPW3oCrEdNRfUjN3LzruWcOPP1VJ9AQpyEWffCsjvTT9OjhAumNHu2n+Odh7 aXVg== 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 a2si2058681wmc.201.2017.08.01.16.28.37; Tue, 01 Aug 2017 16:28:37 -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 209C968A2C0; Wed, 2 Aug 2017 02:28:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-1.mx.upcmail.net (vie01a-qmta-pe02-1.mx.upcmail.net [62.179.121.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4268468A1BE for ; Wed, 2 Aug 2017 02:28:25 +0300 (EEST) Received: from [172.31.218.32] (helo=vie01a-dmta-pe01-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dcgaR-00028l-Lm for ffmpeg-devel@ffmpeg.org; Wed, 02 Aug 2017 01:28:27 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dcgaL-0006EK-Uu for ffmpeg-devel@ffmpeg.org; Wed, 02 Aug 2017 01:28:21 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id rzUK1v00o0S5wYM01zULux; Wed, 02 Aug 2017 01:28:20 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 2 Aug 2017 01:28:17 +0200 Message-Id: <20170801232818.7985-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/h264idct_template: Fix integer overflow in ff_h264_idct_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: 26215360 + 2121330944 cannot be represented in type 'int' Fixes: 2809/clusterfuzz-testcase-minimized-4785181833560064 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg --- 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 e1ef68756c..288107d5a4 100644 --- a/libavcodec/h264idct_template.c +++ b/libavcodec/h264idct_template.c @@ -40,10 +40,10 @@ void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) block[0] += 1 << 5; for(i=0; i<4; i++){ - const SUINT z0= block[i + 4*0] + block[i + 4*2]; - const SUINT z1= block[i + 4*0] - block[i + 4*2]; - const SUINT z2= (block[i + 4*1]>>1) - block[i + 4*3]; - const SUINT z3= block[i + 4*1] + (block[i + 4*3]>>1); + const SUINT z0= block[i + 4*0] + (unsigned)block[i + 4*2]; + const SUINT z1= block[i + 4*0] - (unsigned)block[i + 4*2]; + const SUINT z2= (block[i + 4*1]>>1) - (unsigned)block[i + 4*3]; + const SUINT z3= block[i + 4*1] + (unsigned)(block[i + 4*3]>>1); block[i + 4*0]= z0 + z3; block[i + 4*1]= z1 + z2;