From patchwork Mon Aug 13 00:24:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9964 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp2577849jad; Sun, 12 Aug 2018 17:25:39 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzWENysYJVPt4Y6KRmznKktCG3ETtLCM2mxb9WN/xUahgr6ETCJa6+3Ip+S+51qX6cnixEo X-Received: by 2002:adf:a557:: with SMTP id j23-v6mr9093581wrb.220.1534119939403; Sun, 12 Aug 2018 17:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534119939; cv=none; d=google.com; s=arc-20160816; b=pOVY9uPUHZZ8ChF79fs0l0CmdvOyCdJIs9H3/8NtCZ932jVBsrGFDeNc4dks3xK7mp 0l7ApGvKg3imbqGgYG294x+Toi+gl0/45zjzuId7y7/AKziSaLkFc7sYVLIx8xdSuy6e WI0/8gs4UijmuDOwTiTSxZHii4dlMP6u2Zow7KEqfmq7t89Rn3egSisnRlpHwVW55Abp yfcOpGgys2ZxcawPtVZi7kkUzOdpzaAap/oRtoJmpMOXWI+lQis3dogqG1uCOKYMm8fj cki7t7eBXfHs07tHoCu0JAUKbP8kkZYt06qLxJO6Ze1caHchrLx7NjnvNzZ8LxlSc7Gc ELGQ== 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=o7PDD40o+X70uOgDIX5PB5Jw8lhmSBs2ajGUTFFERAw=; b=CtZiAmzCtHcCtxIZauXl4Lsd/YjoP6wBeV2DjMH0uGJWrQs1Pq/A5sI+iUeSNZv/L4 fy7sFcrLSLtCLcjUagmMEzLSsYWmIT4DmpcNUClzI57atUECEmgtAB1F/wbHT3N1wzhm pa3BBMShsEDwSHwT5m5E/WuZlDnbzSqLWEb0KTi9dAC/mUK1NYOqB5DNpoQmY++43U2A XA8rMtWYv5axh4f/IMwhH80wKCgEdPNAjzpghhVmNX0pHwB76uZkwrjyfQAnhWlblG56 HSdkm7iyAibLpm/yA14+BxgbHQxzKRryLUOyNhFPIgVoJu8cGmol2oXr89GtsSD8gZKX /zSA== 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 k72-v6si13434155wrc.55.2018.08.12.17.25.39; Sun, 12 Aug 2018 17:25:39 -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 8B8B168A5A4; Mon, 13 Aug 2018 03:24:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-1.mx.upcmail.net (vie01a-dmta-pe05-1.mx.upcmail.net [84.116.36.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A27076803B2 for ; Mon, 13 Aug 2018 03:24:52 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fp0fb-00088Z-Kt for ffmpeg-devel@ffmpeg.org; Mon, 13 Aug 2018 02:25:15 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id NQR71y00Z0S5wYM01QR8o8; Mon, 13 Aug 2018 02:25:08 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 13 Aug 2018 02:24:20 +0200 Message-Id: <20180813002423.10292-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180813002423.10292-1-michael@niedermayer.cc> References: <20180813002423.10292-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/6] avcodec/shorten: Fix signed 32bit overflow in shift in shorten_decode_frame() 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: left shift of 1 by 31 places cannot be represented in type 'int' Fixes: 9480/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-6647324284551168 -rss_limit_mb=2000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/shorten.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 054494f8ce..1ffb7d8d79 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -715,7 +715,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, if (s->version < 2) s->offset[channel][s->nmean - 1] = sum / s->blocksize; else - s->offset[channel][s->nmean - 1] = s->bitshift == 32 ? 0 : (sum / s->blocksize) * (1 << s->bitshift); + s->offset[channel][s->nmean - 1] = s->bitshift == 32 ? 0 : (sum / s->blocksize) * (1LL << s->bitshift); } /* copy wrap samples for use with next block */