From patchwork Fri Aug 4 02:05:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4618 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp1660545vsu; Thu, 3 Aug 2017 19:05:51 -0700 (PDT) X-Received: by 10.28.74.133 with SMTP id n5mr329810wmi.137.1501812351477; Thu, 03 Aug 2017 19:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501812351; cv=none; d=google.com; s=arc-20160816; b=ulaBWc4XQf5vjVIrdmcqBgfZ0FXZ4pwI8gmTDOiO11YbwZ45reYSjr8urLMdFFBTye bTHzHAwXrJ07cASgnBY+DmqV/F8Gjty1j8+nxxe1bhzUa77xVYuTd7aVCmsKOUWxGe8F wSQNchzIwboLCfv1M1ZZkrbwmL6vJ45tDGlQ2k5IixCnpzADINuwOy/MHsvtN+C//eH8 m3Waz/NhMA5TqWiR0VJR6KcSJKcd85g0oR+kMH9VF9U1GzOC+S5YSlZZSGwmKyIX4l4W 33jX3ouCOnE8MwLnZTH5b1gXnz7V2xgKSRKxksEW1NvM4iKS7V1G2DPlLh/TJ2YljjSq BQNg== 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=sgiN3eysmHSIe/3oRXg/84pYIryxpRTpkg2Qt8+A04c=; b=rwrHHVTopSKRxB1r8hKuGadwZ1JD7mE4xTji8YZqsC4+Kzv46Y0dfgQ8NbV/gwivYg BGHl6Z1Jv9M+BSR6gyk7k2/QFaSBS/U1hEvcE8IEEH49n+EjG8iYUREQxSVg930YGm47 qBOpRyVjV67n51kgB4QNisuTbOpv53uGnKgL0q3L1z2A5sMMywx4Gt8S0+/UL75tJ3r3 oYj3mpkCTeCY3lgvqWDIrXX+PVr9Vf4elfK06li54gXuCiZeVZnm7CDXMdNTv9e1sFlP VBn7hvs1dSCuwxGYOoAlvOUDFq3qciDAH77+BBNMHIwEnEDhk5UWeaBUhWFyrOeIGR8t DQsg== 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 j140si2350753wmf.188.2017.08.03.19.05.51; Thu, 03 Aug 2017 19:05:51 -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 15479689735; Fri, 4 Aug 2017 05:05:48 +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 A3EBC68922C for ; Fri, 4 Aug 2017 05:05:41 +0300 (EEST) Received: from [172.31.218.35] (helo=vie01a-dmta-pe02-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ddRzh-0000oe-90 for ffmpeg-devel@ffmpeg.org; Fri, 04 Aug 2017 04:05:41 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ddRzb-0004uz-Ei for ffmpeg-devel@ffmpeg.org; Fri, 04 Aug 2017 04:05:35 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id sq5T1v00c0S5wYM01q5UpN; Fri, 04 Aug 2017 04:05:28 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 4 Aug 2017 04:05:25 +0200 Message-Id: <20170804020525.870-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170804020525.870-1-michael@niedermayer.cc> References: <20170804020525.870-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/aacdec_fixed: fix invalid shift in predict() 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: shift exponent -2 is negative Fixes: 2818/clusterfuzz-testcase-minimized-5062943676825600 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/aacdec_fixed.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c index ccfef7f652..f6a533010f 100644 --- a/libavcodec/aacdec_fixed.c +++ b/libavcodec/aacdec_fixed.c @@ -305,8 +305,12 @@ static av_always_inline void predict(PredictorState *ps, int *coef, if (output_enable) { int shift = 28 - pv.exp; - if (shift < 31) - *coef += (pv.mant + (1 << (shift - 1))) >> shift; + if (shift < 31) { + if (shift > 0) { + *coef += (pv.mant + (1 << (shift - 1))) >> shift; + } else + *coef += pv.mant << -shift; + } } e0 = av_int2sf(*coef, 2);