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 55CED49B17 for ; Sun, 3 Mar 2024 11:01:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BC78468D39B; Sun, 3 Mar 2024 13:01:19 +0200 (EET) Received: from sender-op-o10.zoho.eu (sender-op-o10.zoho.eu [136.143.169.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7808B68D365 for ; Sun, 3 Mar 2024 13:01:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; t=1709463671; cv=none; d=zohomail.eu; s=zohoarc; b=ZzvQpWK42Iz7+20GBGGAbjFEuCrCXBKKA5r/9cix9gxIFh/zuv5l9iEbQ2vD9Eg2BgeUamt69BAnP5OMliQzpcuyTnAQanXKuKLi4E6ovBCLXexOfa/QESeU5oNvc0I1VZkCat60ys9RC86JmijYADBWkiQyzd5urTorYFDFl88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1709463671; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=zg8+me79bg2ZK5gPjhENa3Wy9ygL6YpuFpDGSFKNyX8=; b=ESltIyHVu6RPXl7IZVoRMvAAATRvyKGphyqQB7r3Add3i6D/HPuuk37TZmzfuZe4tNZI1hxDhdvumrKMG31+vHcLeXQ5Jex6PRDbLLCZ0EfGzyocV4rQ+JTtxViWHLMj0jwMJF9ET7F3s/VvyL1aQVB7+tzrveNdgoh6WdCB8+M= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=frankplowman.com; spf=pass smtp.mailfrom=post@frankplowman.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1709463671; s=zmail; d=frankplowman.com; i=post@frankplowman.com; h=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc; bh=zg8+me79bg2ZK5gPjhENa3Wy9ygL6YpuFpDGSFKNyX8=; b=H4W7JkoYmYvok0hBx3IMlVtPYxB5VToOv1vS0JIIgqJbH9iuSO60Wfv+ki4RAqXg YOxER8jNu0W3kFfe6xkfM9NCvTwDst1P9hwJ3oATj3gITacP9zEcjer5nT23Gexj0hR YngfekYD6iyIfrpqBC35XTMmqVs4J6fr91vKOMt4= Received: from [10.0.0.6] (frankplowman.com [51.89.148.29]) by mx.zoho.eu with SMTPS id 1709463668763307.645603232291; Sun, 3 Mar 2024 12:01:08 +0100 (CET) Message-ID: Date: Sun, 3 Mar 2024 11:01:08 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-GB From: Frank Plowman In-Reply-To: X-ZohoMailClient: External Subject: Re: [FFmpeg-devel] [PATCH] avcodec/vvcdec: check pred flag to fix undefined beavhiours 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 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: On 03/03/2024 03:31, Nuo Mi wrote: > libavcodec/vvc/vvc_inter.c:823:18: runtime error: signed integer overflow: 1426128896 + 1426128896 cannot be represented in type 'int' > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior libavcodec/vvc/vvc_inter.c:823:18 > --- > libavcodec/vvc/vvc_inter.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/libavcodec/vvc/vvc_inter.c b/libavcodec/vvc/vvc_inter.c > index d5be32aa14..48c566b097 100644 > --- a/libavcodec/vvc/vvc_inter.c > +++ b/libavcodec/vvc/vvc_inter.c > @@ -816,13 +816,16 @@ static void derive_affine_mvc(MvField *mvc, const VVCFrameContext *fc, const MvF > const int hs = fc->ps.sps->hshift[1]; > const int vs = fc->ps.sps->vshift[1]; > const MvField* mv2 = ff_vvc_get_mvf(fc, x0 + hs * sbw, y0 + vs * sbh); > + > *mvc = *mv; > - mvc->mv[0].x += mv2->mv[0].x; > - mvc->mv[0].y += mv2->mv[0].y; > - mvc->mv[1].x += mv2->mv[1].x; > - mvc->mv[1].y += mv2->mv[1].y; > - ff_vvc_round_mv(mvc->mv + 0, 0, 1); > - ff_vvc_round_mv(mvc->mv + 1, 0, 1); > + for (int i = L0; i <= L1; i++) { > + PredFlag mask = 1 << i; > + if (mv2->pred_flag & mask) { > + mvc->mv[i].x += mv2->mv[i].x; > + mvc->mv[i].y += mv2->mv[i].y; > + ff_vvc_round_mv(mvc->mv + i, 0, 1); > + } > + } > } > > static void pred_affine_blk(VVCLocalContext *lc) LGTM. I happened to have a minimal case which reproduces this handy, and the patch removes the error. -- Frank _______________________________________________ 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".