From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id ADF0F45E4D for ; Tue, 9 Apr 2024 07:56:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A66D168CFE3; Tue, 9 Apr 2024 10:55:59 +0300 (EEST) Received: from wrqvffvh.outbound-mail.sendgrid.net (wrqvffvh.outbound-mail.sendgrid.net [149.72.255.128]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EED0768C8CC for ; Tue, 9 Apr 2024 10:55:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frankplowman.com; h=from:subject:mime-version:to:cc:content-transfer-encoding: content-type:cc:content-type:from:subject:to; s=s1; bh=NbWw97kBqlboqP2P8gIHW6p5oHp8ytAPBpDNgdH3dNk=; b=sS+70+LovxROiuJeUDiXgMdf4qKSinjqSDbGN5Xjy9Tj7TaF41ZqMdKOR7XVAFMrdlET agc+Kh+o8ERRop5ZheDK3tLhU1rCmE38EM1sZ0mxoFKmTR14gfj4IbijfNIPuTkG2VALb+ hFTGGkYyBMdD9pKbucUJY2fHytLSlvr+/Cg2xYrJmvsvrFRtRswXgH6tu+82BHdYnzvIKF d3b6LAlibPTKjhnAa2xflzJovNPthDvxLg5O5inpqfAtdtaGpdajh/WUoplCGNTpgw5i+0 z0iQ0sjbjUE24g6RImC4tQtJwAH2tu7ErcktpxqkBg0vJXujBu43thCBusoQBpTw== Received: by recvd-7555548f4d-zxlph with SMTP id recvd-7555548f4d-zxlph-1-6614F488-2 2024-04-09 07:55:52.493966617 +0000 UTC m=+1853740.772154214 Received: from localhost.localdomain (unknown) by geopod-ismtpd-6 (SG) with ESMTP id Tb39VoK7R_6Ryb3Vs1WJbw Tue, 09 Apr 2024 07:55:52.262 +0000 (UTC) From: Frank Plowman Date: Tue, 09 Apr 2024 07:55:52 +0000 (UTC) Message-ID: <20240409075544.7985-1-post@frankplowman.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?u001=2EZ0KJCHpts8tvDq7PHgz5cpqJ+vJcSmdTtST=2Fg91WT3qAbNxUpEMGIDQq9?= =?us-ascii?Q?1mXy3Yjvepp8fYsFUJzGsyhT1EwBX5VawAWcfhA?= =?us-ascii?Q?GlmbPDuke+BXk5WjGkXv=2FD3h=2Fs9rA4LIqINVgix?= =?us-ascii?Q?K6YLHJw9aFDcg3udeAb4yfh6YAvQsIdwV35rwKE?= =?us-ascii?Q?REHr0DKIEebOdPqu01IsDso30e0X22C28av3k7O?= =?us-ascii?Q?Gj7U=2F4ePTVDca7cYUlFoGLkWqj1aS+dLW75EHRw?= =?us-ascii?Q?fbL=2F?= To: ffmpeg-devel@ffmpeg.org X-Entity-ID: u001.qzljkbu34TNIX4NwfTiKWA== Subject: [FFmpeg-devel] [PATCH] lavc/vvc: Avoid overflow in coeff scale intermediate X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Frank Plowman Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Make intermediate result 64-bits to avoid an overflow before the right shift. Signed-off-by: Frank Plowman --- libavcodec/vvc/intra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c index e515fb9710..5ac7d02c80 100644 --- a/libavcodec/vvc/intra.c +++ b/libavcodec/vvc/intra.c @@ -416,7 +416,7 @@ static const uint8_t* derive_scale_m(const VVCLocalContext *lc, const TransformB static av_always_inline int scale_coeff(const TransformBlock *tb, int coeff, const int scale, const int scale_m, const int log2_transform_range) { - coeff = (coeff * scale * scale_m + tb->bd_offset) >> tb->bd_shift; + coeff = ((int64_t) coeff * scale * scale_m + tb->bd_offset) >> tb->bd_shift; coeff = av_clip_intp2(coeff, log2_transform_range); return coeff; } -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".