From patchwork Sun Feb 26 19:28:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 2687 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.149 with SMTP id x21csp708654vsf; Sun, 26 Feb 2017 11:28:55 -0800 (PST) X-Received: by 10.28.7.10 with SMTP id 10mr11558657wmh.55.1488137335199; Sun, 26 Feb 2017 11:28:55 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k20si10719376wmc.118.2017.02.26.11.28.54; Sun, 26 Feb 2017 11:28:55 -0800 (PST) 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 91CC16882EE; Sun, 26 Feb 2017 21:28:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-1.mx.upcmail.net (vie01a-dmta-pe03-1.mx.upcmail.net [62.179.121.160]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D81E6882CB for ; Sun, 26 Feb 2017 21:28:38 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1ci4Ux-00014K-LR for ffmpeg-devel@ffmpeg.org; Sun, 26 Feb 2017 20:28:47 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id pXU61u00k0S5wYM01XU7ei; Sun, 26 Feb 2017 20:28:07 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 26 Feb 2017 20:28:02 +0100 Message-Id: <20170226192802.4486-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170226192802.4486-1-michael@niedermayer.cc> References: <20170226192802.4486-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/dca: Fix multiple runtime error: signed integer overflow 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: 680/clusterfuzz-testcase-5416627266912256 Fixes: 681/clusterfuzz-testcase-5013323462475776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dca_xll.c | 4 ++-- libavcodec/dcadsp.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c index 3dfde6b68d..6cebda35e4 100644 --- a/libavcodec/dca_xll.c +++ b/libavcodec/dca_xll.c @@ -652,7 +652,7 @@ static void chs_filter_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band) int64_t err = 0; for (k = 0; k < order; k++) err += (int64_t)buf[j + k] * coeff[order - k - 1]; - buf[j + k] -= clip23(norm16(err)); + buf[j + k] -= (SUINT)clip23(norm16(err)); } } else { // Inverse fixed coefficient prediction @@ -1308,7 +1308,7 @@ static int combine_residual_frame(DCAXllDecoder *s, DCAXllChSet *c) // Undo embedded core downmix pre-scaling int scale_inv = o->dmix_scale_inv[c->hier_ofs + ch]; for (n = 0; n < nsamples; n++) - dst[n] += clip23((mul16(src[n], scale_inv) + round) >> shift); + dst[n] += (SUINT)clip23((mul16(src[n], scale_inv) + round) >> shift); } else { // No downmix scaling for (n = 0; n < nsamples; n++) diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c index 3d637f63ae..1503d00886 100644 --- a/libavcodec/dcadsp.c +++ b/libavcodec/dcadsp.c @@ -300,7 +300,7 @@ static void decor_c(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len) int i; for (i = 0; i < len; i++) - dst[i] += (int)(src[i] * (SUINT)coeff + (1 << 2)) >> 3; + dst[i] += (SUINT)((int)(src[i] * (SUINT)coeff + (1 << 2)) >> 3); } static void dmix_sub_xch_c(int32_t *dst1, int32_t *dst2,