From patchwork Fri Oct 21 18:56:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38870 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp925709pzb; Fri, 21 Oct 2022 11:56:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7onTk1t2vWnrldRGcWb07xXHA8fma5x5jTwsBFYo3ZuuZQ3MiD/3yKspCOtt9cNK2f105q X-Received: by 2002:a05:6402:5485:b0:459:147a:d902 with SMTP id fg5-20020a056402548500b00459147ad902mr19453987edb.263.1666378576016; Fri, 21 Oct 2022 11:56:16 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n12-20020a05640205cc00b0045c29d74fcesi25655885edx.568.2022.10.21.11.56.15; Fri, 21 Oct 2022 11:56:16 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=A6QL5DWN; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DD70768BEB4; Fri, 21 Oct 2022 21:56:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064013.outbound.protection.outlook.com [40.92.64.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1E72B68BE18 for ; Fri, 21 Oct 2022 21:56:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=es97TnuobNWfBkXPX6adXS31BlnnsSZiy0tcx8NttM4fkDf5rzRJimKa03070UnT0PPDM8dKs5g/kMBIwSLdtJp2TBRAUItO1ktXJf/xlYYJ2CCxe+5Qv3AAHSFk9fcfg0YYuSZxXGJo6gQv7Z4KYHWn1pHPtHtnSVWeFB97bhdYfxyTAnrQPXbxukizejYV7SFYkgt4Tm08UOYIPS/T+tGZRU93aCQeF7JlfNhwlPHQ7ct/CHqp8WuPF/NsFn4f7QCs0mOyjmlfNkSMI7xsxwgo1ow8FfzuwMWMdJi15n4MzFuK7ISYzys7FPvesVmZk72mUXu7lWDFSUzU2K5HwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KymSFr79h94dLXaYKoemlVIb8wa9TtAXl7rpMK2/kCg=; b=O3Io5bd8glqG7PfzJ1DfIpLjcTiNR9pY9VPq8U8Rk4KN8CRTQSU9gq2+I+LSK2ZHjHb8IrEHZ9y9krI+hlopAsbDXYLvdXZpm3+hufJRYcD14JwNJ1s9cmpWPPqf/0O9bHD+Q6/x5g0hF8W1HOiOgHDm17B5dA2tSHJ/1Y9npo502ACAE0/gg4b8O2DnPI5vuVXeI4j8WaO5vjFoljnnNde46bMofkEFD9Veje4bKkFXe4//N414Yw87yqedysdZd0US6GMpMr7EogpBMSQisZklmX/Wyzt2PkYD7+sopHOhHDr4E1TARZ9nL9qFcjBeO6vGwq0/LhScqhWjqzLMIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KymSFr79h94dLXaYKoemlVIb8wa9TtAXl7rpMK2/kCg=; b=A6QL5DWNGiah308aFncG1QDwlPI05w/crnOLNF0AHt7DAgpkq/6RcGTtmytF51ZqAQJc/DpOYZJqYNNEkleoY/hnkE3mA4kC8LiPjWgRgOkYhYC+7aVS8Ysz3/Zpxj5ji6Kz0eA/igZMkDifmHUw0A0mE3lHDdhSmKY8vddo0SgKasAkWWzwi4Z16Bv7p0O69tM/DqaP6TOFdm0kV7mNrd3M6vuIv/V5uYHunqvi/I5wmuEWbMeKn3xKRbGzSVZmNTXAxg0p/AK1kHcLDPJQuK8m9ER1y7VkNripecHm8ZAySOWeByEXNrkRa83v6qr2jX4/ixyBkbYlql/nArUIew== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0491.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:291::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 18:56:04 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 18:56:04 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 20:56:02 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [Io0qCgW76Nj5TDxW0wjuqsun0OzJ3VOtrEZBeY6QGKg=] X-ClientProxiedBy: FR0P281CA0058.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::19) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021185608.3096100-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0491:EE_ X-MS-Office365-Filtering-Correlation-Id: 27c9c9e5-78b9-4305-11cb-08dab395e753 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmoyh0/rGpTlCzjnzrUxdxR9AxA/obCFEpFjoECRPocvLygtWmjfJY03umvhtr3MbBdunRumPFU/N41UXtFdU/9z/fAdhZ+wUQDXM5iW6GdHwARThvDGDlSGPZM5xft1uN66H99patHgD2NduEPcCghqYbY2yZRoNey2zk+GubIS7T90wXiXHAH3lCAfgSlIncz9LaXpEOHgqn9BIBtIuIC0pXlnXCg7lDHgj+wq45KHLXxoaTY8V7EoBaf9lwB2njtaLZvOcmNm79UT6T2br8JtvqjGWfHUXaJGuD6XcRQB/UXMCF3kSFQ9JohgQyh+W6G0F6WIb/Dl3w+dOTU7DmaDqCX9BeXzkFpeQSinpqmg/hWmZlfW9zSWGrynkHmfaS41JyDXC9O0UtH7QOPpTCat65g0hmqC4pVGzQ/ttwlsrOxoWzYsMAFQR5nmmJXSeXA8hzAc5T2I4hKyUnuEqQ/netfbcq810YpKh+d3w+Ych8YwsiQ8/vgHeVJqA16wAAL1+N4JINdNvXnulam1CnT40XrzPQ1DTYfj4+MdQyGLwXxV0KurF9qbEML6CEbseecG2URxDAVN5beEBCYB7b4mgpTJ98zyciMEDuaXUF3sWarvF5UlpVZ8NVfrRJnb8qKOgNrA5Bb/bYdhliZlnlrT0htxcXbo2aOpjS+JNxzF5KqY2+o0P/f1N4vtYjelVllPfmnSeOPS5L78uMsAWaxEWTUT+QPWz715/QcsgZxa8Psglrsd/N1i8EDNu+xfWYA= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lR3VqdNNbi5uRY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cb-08dab395e753 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 18:56:04.1795 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0491 Subject: [FFmpeg-devel] [PATCH 1/7] avcodec/snow_dwt: Fix left shifts of negative numbers 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6jvCFtUtMQwo Affected the vsynth(1|2|_lena)-snow(|-hpel) tests. Signed-off-by: Andreas Rheinhardt --- libavcodec/snow_dwt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/snow_dwt.c b/libavcodec/snow_dwt.c index 18b315ef66..965f409002 100644 --- a/libavcodec/snow_dwt.c +++ b/libavcodec/snow_dwt.c @@ -778,10 +778,10 @@ static inline int w_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8 for (i = 0; i < h; i++) { for (j = 0; j < w; j += 4) { - tmp[32 * i + j + 0] = (pix1[j + 0] - pix2[j + 0]) << 4; - tmp[32 * i + j + 1] = (pix1[j + 1] - pix2[j + 1]) << 4; - tmp[32 * i + j + 2] = (pix1[j + 2] - pix2[j + 2]) << 4; - tmp[32 * i + j + 3] = (pix1[j + 3] - pix2[j + 3]) << 4; + tmp[32 * i + j + 0] = (pix1[j + 0] - pix2[j + 0]) * (1 << 4); + tmp[32 * i + j + 1] = (pix1[j + 1] - pix2[j + 1]) * (1 << 4); + tmp[32 * i + j + 2] = (pix1[j + 2] - pix2[j + 2]) * (1 << 4); + tmp[32 * i + j + 3] = (pix1[j + 3] - pix2[j + 3]) * (1 << 4); } pix1 += line_size; pix2 += line_size; From patchwork Fri Oct 21 18:59:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38871 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp926789pzb; Fri, 21 Oct 2022 11:59:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6h7CLrxm2y1PGSGQgGuDylkEvj1YphKR/YJEvsi+4XqCsqCrMFodBBZxkNKhVvKTOQFZjH X-Received: by 2002:a05:6402:847:b0:45b:d50c:b9aa with SMTP id b7-20020a056402084700b0045bd50cb9aamr18568123edz.289.1666378787814; Fri, 21 Oct 2022 11:59:47 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ae12-20020a17090725cc00b00783160b16a1si1272475ejc.397.2022.10.21.11.59.46; Fri, 21 Oct 2022 11:59:47 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=dElvvq55; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FC4E68BEB7; Fri, 21 Oct 2022 21:59:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2046.outbound.protection.outlook.com [40.92.58.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E200568BE9A for ; Fri, 21 Oct 2022 21:59:37 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iOI/G+wVxNzoorb/Y+hr5xuJqGLvZL6CtODzjzW10RczMUMmPGV3NB4CMLbfZwFHj91YBOI5jIqiy0tvBGtYSMs8ND9MxR+8dZS/fjHFqvDtgI2gzekPihiAGL/PUqGVxnf5+5u37l15XMveQpa5lz6K5CpnqYD3IsHDwzgWC53AlerSFMhX2U7kiUPTEPQ6T5LQkCqomw2w8gXQxhghyv0cbpKuGT8Il1SyV/TlrKhpBW6a6IGeHxvEinKh+kzjPcbXHR36L7gqIRbJUa3fq2l/8luxahNRt5NpQYPovj5CoQihrydKtZA2EnakOOTNRXZXPG03OmaVN3A6jzXsuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SL4c61EPLyj+aga355c9flH4mpJwGIbE9vBc3Oqhrcg=; b=gODVQ2z6Qy6kKtQoIUDdhV575muKb/zkokIBigQN5eTctHWEFl/t4sXGuXRg4+uqdirGqcoqoVdt2HjYRfHyQbIx1HLh7tTU/RYyOGDQ/ZauSjvlaFgiVlpKd9YC1oaKdLYj+UVNwsvMQFIe/ql1Kqf1wTvcq4VNgO8aLWf5WnhpV/5DSE2DRi0shytOM0kBzW6+cLurU2XBAPVXCbk26QMqUrzVFH/z39VxXK1PYxAc4FhMau17+cZLsTfRpXAW+hmbMn0NIRe7fBl8LhE9NgMDpSPqU73CzmDNEbo3zXzX5BLTfE7fO59EegxavK+Q/iXW0q3UkYQdxlV7uuZWTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SL4c61EPLyj+aga355c9flH4mpJwGIbE9vBc3Oqhrcg=; b=dElvvq557sld49f7PXp7bAoS2AoU4OKzed8LDyUOLVpKAfUxG4SX++PBhefKCqrKVB4U5k968G1fhgP60ZnQRu2l6r0RcCfdYIj7qCx77uOafFUEvmB1dMrCwmZScqx4wvz+hWA0Y9oecxqym29jiOrefm2h9jexoyyOhn3EPRdH4/wxQ0TQECUnPFZOgdu0zB6HZOtPDaUQqisRj1ssFoSHkEE5t/4LwM860GuYBsb0wXP8REzl7wcsybNYMapJaDdLh+jRbgMCtwBqmWIH63eackFaMG0qomB7ZB2EzQ8W4qB6MESJaXB2xaxI+Rd5jxTwfvpvTUR62urU5Bt1vg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0491.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:291::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 18:59:36 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 18:59:36 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 20:59:34 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [XyJiHuGfdStaAYYqS7l2D+E+cUjwZv79kx7OV8atUUE=] X-ClientProxiedBy: FR0P281CA0047.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021185939.3096155-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0491:EE_ X-MS-Office365-Filtering-Correlation-Id: 15f187c6-84ed-4c8e-dcc0-08dab39665f1 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmoyh0/rGpTlCzjnzrUxdxR9vNfqogC69P2PQYY8steROLJv+7oO9ajDRZxlC+lnojkkunPPNUIV5gIzvOummWqxomqCJ5Sg7GiC0MTO57lpWekpfezHKtLWXFn2Pb1HWmOnutMtHd2jOAXEWtBe970rVhB2lx5/rBj8uHVY/lW4BxMJhBKQL7hpRGTpmYa0lFbTJLjqGUkrTurf7iFwxlia+a+8kl+9IOyxBAFS0nboK78Kv2JYPKprGVd5TDh3ZtB1sVUrnkcF0cFv14g64NRYqOjavkOM19nzVMYhUEUU9BSM0pnZXhXxtA9wRsPYhDpvrJg4f8OJdpQ96X262B3fR4tg7lgB9848FDJqDz9YSB/QLdxa8WzbDREm2ufSLi8NAUEuKOnfTwcrYMzrvcLja7Ov05Lal9SEMRCbruK/CdkBRkMTNJjieAsrxqTujGq4JtPKcuRAOZ8K4lxomlLT3n6KD6VCPRXc6qQomFPXdUkbkrHrsoMrDR1389Wve5eiRX+aw7wt1hf4k6PzwHFcjY5XzskJWeFb6AGXHu3YsQbgOa+g8GIK2GKi3OAHWTzNvFLqr66RwPtpUG3CXmcUutz8teICUAKozFH5GHW/r8Xye/I1aHDu+b9JvAdimyOk2BP2p/yDVWrdMkMPyt4w8NrYc23h4oFcoH4nXBIswisNkmcd/QF/WRRAZG2ErcmzgWqr1lgjcx0o4szsePGEmvPkEOXlhvQ8JU1Aq1m9EpFZUqFjWRQX1odjGr/WlZE= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QQhaH3B6kkDq7a67sE8Bdcf9i8NuemMsubOzC9c7ieuj4UdRp61sMNe8gbztvegm6sc/Weavke4IIqPN5/cswIx1ZBlGnZA2FUB+RdC0MmRcgyF6sf9Y69zbJtN1rsV4t25fqxOggmscIIXea6TE21TFf0yA23WFKrSNuZvIrTebV/Ou37eaP/U4lO0KqNn/IsHmEk2MgKNCmZe4W9ABViqk2DlJ64mrE0pJEzQZdYFguGrIc49/15z7+jbRfH16YwMZtEP6Vwq9oiQG5kVQ8kP/ugBDs5spWZMvXJailVW5OoiSsL6puOmXiyL7aQZjh1xG5nrjwJO4PBVvwgMSkjH9dZ/hq0MmT3a5JrO4xwu7v+jbRENUgXYN1fqMkZRyHZody3OJHxqSylz7SXHOh2oHF7+cwuNESFC4UHBhgU69PSCx8AmZy91Dv6SaOubJFDJQw8yBbBaqoHw65Z4y9Ev1naDWSnvj3LlHDerSZGy+4dsGHnt9zD8n6YK/jZ2lzIWvkQRf6WqnZ0Zi4T7lfuF3wWt+NN0gYkLo118xKCfAi+eIXDBlKwpE8yaseUuGY139gHJsvEDOrV4I8LIrIfBPKYw8Pe//nIcwbtrKANnQG6E+w05+GYTRR6cGPQR50hhkUGtcZQ6euEpC33L1EFi/HgsgwCuryo7qhMPImNunD9gvDgvadZuWXiAVdDXk X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lcTpw8OW1sz/PaYwOoIsToLTE1MbnloaGcN0032NXqtZT/WjxiplPX2mvn71nmBbnroF5HiG4jPqjj1xYAN4l55awVzcdLo1kArZFpNMEWxhvfSHKy0mZwTk8NQEqXuDiwyYeGbOOzz1+u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F7voSIDaKrDnym/OyhYQRulJZnQ7UdXHb8xS/QcPWyYK/oe1Di8uQ2eMdKkvc1hRFteXwZfdi8WnJDRSHFDWkqE+kmywD+/SACMSC8/ozdaM= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15f187c6-84ed-4c8e-dcc0-08dab39665f1 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 18:59:36.5048 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0491 Subject: [FFmpeg-devel] [PATCH 2/7] avcodec/motion_est_template: Avoid using last + 1 element of array 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: pjYcqOp/dCI5 For an int array[8][2] using &array[8][0] (which is an int* pointing to the element beyond the last element of array) triggers a "runtime error: index 8 out of bounds for type 'int[8][2]'" from (Clang-)UBSan in the fate-vsynth(1|2|_lena)-snow tests. I don't know whether this is really undefined behaviour or does not actually fall under the "pointer arithmetic with the element beyond the last element of the array is allowed as long as it is not accessed" exception". All I know is that the code itself does not read from beyond the last element of the array. Nevertheless rewrite the code to a form that UBSan does not complain about. Signed-off-by: Andreas Rheinhardt --- libavcodec/motion_est_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c index f3e94b7ebb..1888697db7 100644 --- a/libavcodec/motion_est_template.c +++ b/libavcodec/motion_est_template.c @@ -281,7 +281,7 @@ static int qpel_motion_search(MpegEncContext * s, for(i=0; i<8; i++){ if(score < best[i]){ memmove(&best[i+1], &best[i], sizeof(int)*(7-i)); - memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i)); + memmove(&best_pos[i + 1], &best_pos[i], sizeof(*best_pos) * (7 - i)); best[i]= score; best_pos[i][0]= nx + 4*mx; best_pos[i][1]= ny + 4*my; From patchwork Fri Oct 21 18:59:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38872 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp927097pzb; Fri, 21 Oct 2022 12:00:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6oueD83Ghk7M9ElIw+RdS4aFfINAGJsouHiKbIsjEicj1+4AGsTnNDeay6q1dXPRrRVtiW X-Received: by 2002:a17:906:d54d:b0:78e:2fbf:ca2a with SMTP id cr13-20020a170906d54d00b0078e2fbfca2amr17198544ejc.488.1666378837251; Fri, 21 Oct 2022 12:00:37 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v14-20020a056402348e00b004511d552be3si25182813edc.4.2022.10.21.12.00.36; Fri, 21 Oct 2022 12:00:37 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=cFkegJEk; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3851C68BEC8; Fri, 21 Oct 2022 22:00:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074078.outbound.protection.outlook.com [40.92.74.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C4D2E68BE9A for ; Fri, 21 Oct 2022 22:00:27 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TETU60ZffErciL4bw4XDJtOuBFcgsEcQUZW8KbtnSVwRU3pJJ/zNjqRFfwtvJAkuaDrZtCXQUzlBhIfYKA4RSdhF5cscJAtWiOrKwXDQwwEJDxZlZwOVLeNK3syeZ4KUMImni9yenEQvXee825NvHsa0rCGaCR4EQY3eDv/gFshoriQl1xurAXfWP3Sq12gE08qbj7DWCZXXeubmmDUYCZiXNSCeyLyVVskkRFWWGf6Jbb8PJ1ov44HX4o/zIMUE5rRwMi6GUzhue2iTdXzVdrhiCERG0uZsIShW9+JfpDT68jBTO9bjNkV9pFmaukQZ/PF6jg1ikVXGykVd70FvIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5pG/B+PkrrzwT/VCYog1+30KLJhFt06FFy2IhQEgv+c=; b=dA/n0OACFW9tNm+rP4ya0Un0oMk0Bi7HbUC9sm0p8ZqltxDXcmA2HE65nTPA/lqo++FFuy4UY0Sj0KqsuZZh/q9TAp6+ZnbWpGFog7iYi+sWnwNc72NCYhSbogEcjXhaqIKXBQlGt6S1Cg3v1MgUo8KFyHkstF7lwpFlWh06NPEQC19mc+CMidxjyqVE8i5+IzK1I0Y+jQYFTqE3ZHPyu5z3eLEcwdW9P97LTfb9Vqu7sHuvpsU18pq0UQut23t79rD/oiHhkpKTqQFlrdGSwqBTWgKvq12zS6O4JAs3Fgm5bVYfolifV/fEZ1bV0ZAPIJjfC+hpLs3E8DFk/wSKbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5pG/B+PkrrzwT/VCYog1+30KLJhFt06FFy2IhQEgv+c=; b=cFkegJEkwVfdcdC06ix4BG6JbGRg5RhnuO2LPfAFYh4FHTyOSHzejPlkrnSj06j8MRg6CeXKEispcjXw7qz3jdpqDg7QXZ244pxdGni1DWBgSBVx30KbIaZzH7Yb2J+HcKh3KC8tLQIObW0LStHtiQXXUcbDsANkA4+p7HMMAX462qbUD12JrVpDx9hntulLl3TIDd9gxBO2ek/6EB0Kdwt5u8D1i9BUPf1xDbE4WI5uGpr8jWBIVz36zXxVx0MP+hI84WMa3zEoXqR3fcKNjnar9yrt/JlzgruRGaf9dzPJMaL1qQp/oS2PIomVIvpquhDrCBEca6jhuVL5LRnfgQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0491.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:291::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 19:00:26 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 19:00:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 20:59:35 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [STF89MNxMUhyJvDWUIIbuEC+XdeSBPADBc+P7/SOlI8=] X-ClientProxiedBy: FR0P281CA0047.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021185939.3096155-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0491:EE_ X-MS-Office365-Filtering-Correlation-Id: c4398e25-32e4-4eb5-63ee-08dab39683b8 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKxlwt21SJ65rVaESusrU4PPl8ZXoOY0RAb9J/x3OEtfLESNhLOm8m1DPwE1yezzSgWy8LPcO1vuWDi0ZUtZqHXjxgWcvYc32GvXgAJW0kvitVNsBXUtrIlvip1ASUMlfiuX5ggYCMfE/41RYcpwsIe50Gpon2DsXU3H0WUJBZov8Nc+8vvRXrEq8/aHyc7660puhSCRu13aqGcpbVYVnCd+CPX2+Zs7JykhmR0ypJNvkPhsEZ9WkMthxaNoX5L9pwaFHekzTsO/RaNlLsqfROhGxopeG2XpaW7ewFhVt5gaGT3WU6u1QeaSQRNzjpwsjo688LwDeV2JiQwuP1b4fv+f0651WPRWb34D+hzdncOlkdt4VNnZ5QU4laAcc6O9KfTUTvJACgSRdc1UsGxwmCMdMOUYJ26weRihoJmZPtibq8UxJDvrk0GlSRyF1UEuEu07FO/yYneMUlpuJ+9cATgHtoPte8gcEnSynZvnZ8R4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w/WSHO0MeTH6Rvkt3F6pxSCyFq1pa3RhdhZWUCIqGWCHY9gy7diHlfTyvd/6E7/qtzaLku/bQij9sF4nz4u4mq+pbNJm/8AGCU6C8hqOZHW+NRQrOqWy1xRtyGL0hTCHrM8zZTfRBtT8WhT5pCM97q7aDMDww7AnDpn4qiCbf3I6teBGEyZNIihPL4veByguDNPInq84oSZFYG7vo8h2tbLVqtqAF7RJ1yYJjVtAQlFHkDF0vKl X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4398e25-32e4-4eb5-63ee-08dab39683b8 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 19:00:26.5224 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0491 Subject: [FFmpeg-devel] [PATCH 3/7] avcodec/snowenc: Fix invalid left shift of negative numbers 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: xqQo3FvspadJ Affected the vsynth(1|2|_lena)-snow(|-hpel) tests. Signed-off-by: Andreas Rheinhardt --- libavcodec/snowenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index ea0d4fc27f..ada24f7895 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -935,7 +935,7 @@ static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y av_assert2(mb_x < b_stride); index = (p0 + 31 * p1) & (ME_CACHE_SIZE-1); - value = s->me_cache_generation + (p0 >> 10) + (p1 << 6) + (block->ref << 12); + value = s->me_cache_generation + (p0 >> 10) + p1 * (1 << 6) + (block->ref << 12); if (s->me_cache[index] == value) return 0; s->me_cache[index] = value; From patchwork Fri Oct 21 18:59:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38873 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp927221pzb; Fri, 21 Oct 2022 12:00:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6FrGuwxhazwrLwRcbJBAfniWLDTX+kgDagxatK8REs0LoH3itlhtFZdSvjphWZmZIvFoUy X-Received: by 2002:aa7:c144:0:b0:459:f897:793e with SMTP id r4-20020aa7c144000000b00459f897793emr18720619edp.8.1666378850657; Fri, 21 Oct 2022 12:00:50 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r15-20020a17090638cf00b0078e11e92257si17412936ejd.333.2022.10.21.12.00.44; Fri, 21 Oct 2022 12:00:50 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=dUdwVQZ5; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E9BE68BED4; Fri, 21 Oct 2022 22:00:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074078.outbound.protection.outlook.com [40.92.74.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E716368BEC4 for ; Fri, 21 Oct 2022 22:00:32 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nUS7msD8QhOYaKqQFLa0mjbVvPb1REJfpNPKIkfbl6/GW7EPoZgSeIb8NPAVY+RNckWg/G6iVB0EkWqHTxbjQULJIPlRc5VKB+vxrTa5OjSttZacB4+NEnIL8PXK5NVTGUAfgD7hNs9X3fBPWFZmR4eAInUpRr+SmxpmyoUkv3l+wgAdqUborM+OQrToJk1QV18oTM+9DlYu77Z90E9WuJifoPJ2kw16E0yazrrc/+e880nv0V1p2bywKvgxBepapZsWs2JBJX/EMPWB0lcYFJ5PlDHY9vB0zp+T32fXjj0/9o8fDbexdsLy70/hyX8hs//antE/nGOM3aA5G+5PZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iA2HYOkHo2z4SQP4rvnxYVFY9+tz1tdvWvgeVpVodUI=; b=DDAsnGRSBv3x8Y/YQIXJRmcOokc3AeQVnycXTAMJYeGvJzhzYP2ubjqIPP2JfXBkSMrfajVcj0nx7a5e7AFkB3/WzLcy31CnF4+wtbk8ddadeFNoSqzHjUR5Juz+UiT8CwTwvAp89QIqr8PvAQ8XRom801vHw5RZA09zB/IZNt1NtZ+YTdTcCv/IYZ7G4L7V74UrXfySzun4kGagMO3yaxFatIQC0IopICNUFmRspRH/nQyFX2Hu/cOojQFw+m6HUaz8KDfrOpsBjUuEDDsmH93LJExHjfVPbcySuKMRN4uHiPLRc9PF1fQRRh0f/l4uWIj75LRBggRsdKVngOrc2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iA2HYOkHo2z4SQP4rvnxYVFY9+tz1tdvWvgeVpVodUI=; b=dUdwVQZ5KpfIM7brc5RSfskq8NiNB7sfiiqGy6PL6lnPnCQhD9cVegwQQVIMC8MRNyK/2zyHZQ2hNb4CHQYFm86BOiB+R6niaQLTQHYK5YwxIDAd6FvCXVyncgGz6jzITtcjE1dGgT1MURXtd08RGfU7JBb0zKP519kUgqaL0n3SCmuZkLmZGoBSMvFLv2eKyYibXjQIOmROEYTqNHzseGvuriYZsEm0dQewnsM0z6hWCXLKN4RaBMD3+Sv0QKXy4SbdprpOREJH4p7fvVTQu3eyMAryPtO10XAZQ3G4/eniLSy0uyQxS/lX4T5MTjRGwuXUSxPyCK8wZsI1lxpXbg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0491.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:291::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 19:00:27 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 19:00:27 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 20:59:36 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [C0ILxiigDfTGjo94Xs4lfabI+rf8C72gI+jJW+fogAY=] X-ClientProxiedBy: FR0P281CA0047.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021185939.3096155-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0491:EE_ X-MS-Office365-Filtering-Correlation-Id: 865dedfc-b2c5-468c-7e8d-08dab396845a X-MS-Exchange-SLBlob-MailProps: Z9TzpHVL8qp7D/y/uGLRVs6m1Fe8Nvnah+yxVrEPdZ8aRTKjPpnXxNgxJqaQ07wNA+wGd+uA4Rh/aGdKbxm4WdQqPHLvGTXq5k2XT+s9k8cBvVIUg1kYK6/8DbUNijeg9Zkz1KUSQtKsQybRtKCXxV8c0BbS/rD2bmhZAFQkd+AW2I5dQ8g3/TOLdQWA0PpZArDWNP1TIbZxv8nycJvBwo8P1TqSYVO9ZrWIdKT45ZhTQnZVRAi4+hrVvD6x8OwEpPf932aAIegHhG7/hsJUfP9RRPFCc+6gALCuUvukyGWAonhIGPOZQaAIwOxt0/ziafWL3RRa8tWYGKjtI09KLihFF+22fPpV2AV+y2yqXeOltcN7tWn149DN+APRQOwJahkmQrNXXP9Q5tEN6BaA+HEU1F7jlRDjKI9XESlwac3GwB9vMfD0j2YBMz29TeQAGk/Lv/BN74FXZiLmpjlXrYiwaBhJgSNU/At9zWKWrvE+cBtXJ710Lf+MPMdZ2vaajEumwkiXsCGDuN+1OrYBQnoKnYk2Kg6VXSaWNJ0D20TpogrghgIbmJ6YqzRM2YCN60BBGwnZ6I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m0RS7Iw0CsotsI3duDMRdgjhk5fhar/R6J49ZAETiiCXcarfX02QbEnOBEwr3Y2dFMawZSfR1aAZlpmQZXkWJdsrjksEMk4majz8S9oMLmxmSj9ITKqdH1yE5g2W5qZ1d74aO8/MhF9+SLjTU5WE2RdZfmRGN1iXFyBdl7ACinnvb+L64YQ2rz0gfLVtkA7fCuBXLOlTyP0Bjnzjc7rbdBbJ4v2K/4O9gSrDWS7k4XgRaogKK35dTU+QLJSmXYgaTzgkey4V6GukpWdJBZcbVQsr+MvCf2YM23OZNoC1omKCvIBFke X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 865dedfc-b2c5-468c-7e8d-08dab396845a X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 19:00:27.5055 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0491 Subject: [FFmpeg-devel] [PATCH 4/7] avutil/aes: Don't use misaligned pointers 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PnK/FbXWBnBe The AES code uses av_aes_block, a union consisting of uint64_t[2], uint32_t[4], uint8_t[4][4] and uint8_t[16]. subshift() performs byte-wise manipulations of two av_aes_blocks, but when encrypting, it does so with a shift of two bytes; more precisely, it uses "av_aes_block *s1 = (av_aes_block *) (s0[0].u8 - s)" and lateron uses the uint8_t[16] member to access s0. Yet av_aes_block requires to be suitably aligned for the uint64_t[2] member, which s0[0].u8 - 2 is certainly not. This is in violation of 6.3.2.3 (7) of C11. UBSan reports this in the aes_ctr, mov-3elist-encrypted, mov-frag-encrypted, mov-tenc-only-encrypted and srtp tests. Furthermore, there is another issue here: The pointer points outside of s0; this works, because all the accesses lateron use an index >= 3. (Clang-)UBSan reports this as "runtime error: index -2 out of bounds for type 'uint8_t[16]'". This commit fixes both of these issues: The latter issue is fixed by applying an offset of "+ 3" during the cast and subtracting this from the indices used lateron. The former issue is solved by not casting to av_aes_block* at all; instead simply cast to unsigned char*. Signed-off-by: Andreas Rheinhardt --- libavutil/aes.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavutil/aes.c b/libavutil/aes.c index 029d738f87..8b78daa782 100644 --- a/libavutil/aes.c +++ b/libavutil/aes.c @@ -80,25 +80,27 @@ static inline void addkey_d(uint8_t *dst, const av_aes_block *src, static void subshift(av_aes_block s0[2], int s, const uint8_t *box) { - av_aes_block *s1 = (av_aes_block *) (s0[0].u8 - s); - av_aes_block *s3 = (av_aes_block *) (s0[0].u8 + s); + unsigned char *s1_dst = (unsigned char*)s0[0].u8 + 3 - s; + const unsigned char *s1_src = s1_dst + sizeof(*s0); + unsigned char *s3_dst = (unsigned char*)s0[0].u8 + s + 1; + const unsigned char *s3_src = s3_dst + sizeof(*s0); s0[0].u8[ 0] = box[s0[1].u8[ 0]]; s0[0].u8[ 4] = box[s0[1].u8[ 4]]; s0[0].u8[ 8] = box[s0[1].u8[ 8]]; s0[0].u8[12] = box[s0[1].u8[12]]; - s1[0].u8[ 3] = box[s1[1].u8[ 7]]; - s1[0].u8[ 7] = box[s1[1].u8[11]]; - s1[0].u8[11] = box[s1[1].u8[15]]; - s1[0].u8[15] = box[s1[1].u8[ 3]]; + s1_dst[ 0] = box[s1_src[ 4]]; + s1_dst[ 4] = box[s1_src[ 8]]; + s1_dst[ 8] = box[s1_src[12]]; + s1_dst[12] = box[s1_src[ 0]]; s0[0].u8[ 2] = box[s0[1].u8[10]]; s0[0].u8[10] = box[s0[1].u8[ 2]]; s0[0].u8[ 6] = box[s0[1].u8[14]]; s0[0].u8[14] = box[s0[1].u8[ 6]]; - s3[0].u8[ 1] = box[s3[1].u8[13]]; - s3[0].u8[13] = box[s3[1].u8[ 9]]; - s3[0].u8[ 9] = box[s3[1].u8[ 5]]; - s3[0].u8[ 5] = box[s3[1].u8[ 1]]; + s3_dst[ 0] = box[s3_src[12]]; + s3_dst[12] = box[s3_src[ 8]]; + s3_dst[ 8] = box[s3_src[ 4]]; + s3_dst[ 4] = box[s3_src[ 0]]; } static inline int mix_core(uint32_t multbl[][256], int a, int b, int c, int d) From patchwork Fri Oct 21 18:59:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38874 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp927248pzb; Fri, 21 Oct 2022 12:00:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Wgm0gFUr3MU2r7OCnYLirwewcYNmXTKG/V6/mg/CctUwK0vHodM+cmN9sntwouoPb31PS X-Received: by 2002:a17:906:4fce:b0:78d:9fcb:50c7 with SMTP id i14-20020a1709064fce00b0078d9fcb50c7mr17139480ejw.63.1666378854067; Fri, 21 Oct 2022 12:00:54 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hb13-20020a170907160d00b0078b0865d468si20296166ejc.549.2022.10.21.12.00.52; Fri, 21 Oct 2022 12:00:54 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b="s+/rrWCa"; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0A9AF68BEE3; Fri, 21 Oct 2022 22:00:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074078.outbound.protection.outlook.com [40.92.74.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 14EF168B8C1 for ; Fri, 21 Oct 2022 22:00:38 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ncSUvwEl3C9R1/ck9idUFqqyv28riAkFASbzkZCUG5Z6slDe3Zmj776MH9LFskbmmh6cYORC7Ma8z5Dqsbt0u8pC1Zam/VyB+3l1nNsOKXEIPHLcKHV4He9FOgju0fC7OtNZdjRTlYWu2IenwGE3NguRncTjbeRBfuQLS001qlXN/99SYfY86vg2ERromldqgOvHIYsTR187KMF8oE9yAQelObeoTb9NBIClDKsHlqULfHQDvzLBa0vRmLSssyzIzuMxY1YVmJmTgVySsNce7AA9/UGCJMoaRblfrUsymO2U2Vi+DeMZRNwCAe4BDo4an7tg5KPCihBYxMBQDeaFyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MKmW6USXQXmEz9R+DqCRFzADWjDiJolXAXb0bnyAFbI=; b=jDQgPsChsULAk1CAtkoIMuHZQHN9qXRi980g5CCLA9xgD35xJvkgL0BoWl2sqUHM4y2/Vk2V34L8XjqPffgP8EUIuZcsIGikDfVtxXEKOJfijFwgEGiF9xVexmbZ4WSecz76TAUxt7X9nzz1Es9RcH04zTYkOYiTpZo8MbW6Klt4NDqGJ4sSD2jFJeGbjyOXwSdKDkpajB9/7uOXLOs5mpXE2bQZvSM7kQ4C8dBpvG0uVDwXP7E+O4dtS4CWQxSC3RSQV+tKeelxd0p2zgv3e4LrVpAvFtYjErQHA0RTvXmBFXbRHE7n6knRZUeqXkcEN+fHH6KwOk2+R+POO2PsQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MKmW6USXQXmEz9R+DqCRFzADWjDiJolXAXb0bnyAFbI=; b=s+/rrWCaH+kAfma58j0zmlcOPYRoy9A+vTDINBTP+uh2BSmGhfOugtwfBQPTtNJmY/5jkPJmiYZAXjN4DMM65vHk4q3Qd0PsldpmsXNvmjIrC8e1qRE4BrRPFdNB8GMUdG9+6u/4VYcz/oUQfspcRfsOl05WrNQxF5AReAwoI9XP7DhCZyRAzzYpZYdDB6B8bYF6X01/2XJvGyX/LTtWfYCjsth0XcfpiYLcDn1bIYvFww29NGQg9FdT5o9rUBWD1FbpPYUBHCqb0GTXmCCI2x4Cu8U3mrh4cCTAqoTaOTExyar7oe336wXacnzvwWjgq8Z+JKOgppe3ZVM2LZ2hGw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0491.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:291::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 19:00:28 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 19:00:28 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 20:59:37 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [UC9aAMij874Gvq8hCvPnpaWahJHoMPiTuzMAZd9tes8=] X-ClientProxiedBy: FR0P281CA0047.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021185939.3096155-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0491:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c2533ff-8313-4b96-71b4-08dab39684f5 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmoyh0/rGpTlCzjnzrUxdxR91Hl9wChFmIOgZstH3eQ7/Mse54Hrj57ecOFHqFE+cG0rqzmlu1ubcTKCXxqQiR9lxr+3mczSE9yqUduiqshUluSY5pgeiPloMdXR6Yf39muLhqlUlxaArizpABfLUZa5IRBh/NKN+92PFCnYVhlJIAebHVJfo6BKr6yJi3YKR+a0fQtQH03e2P9Y1xTXGcBG3/qKAJYQrpVe+I59LjXC5+5l1jRQscAiL4MGAcLoZzN7TZC5RAyO7fgWKI38BqU6TGydxp7Rm3JksAnJU/4LnP9DQ3EsG/MTeANxPt97EvVWTfDZbjVsdIjD6aPOLZ4vokY23aXsy/nyQPxa/DBkgDsoarvkkDde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m8veADLiyunlko8N3phG2UehJWi2rJJWekO77KFfv7loCksgHEwfnbYCPehtaf1qbAkIzTA6AzMRmfSgay8wsnx8S/t6IJmnM5P7Tw7LfZdS5gqgW6WEnZWKOhYdaS43u5FO8xxbmQO3D6pfgSppWkE3T4rGFht1Bk8pOg0eOP3n+YSiHoDHNE0+08L6EwRVU/StnMpgzo3VsnWAydOsrQI+3mhucydXKMM7znr/BPi/jFVdDuJ/18H+7jHqePUYxHutXgMJvpu0F0pF1dP2HZKKW586gFczTOQUzVFPqaIkv5WKdC8ugDZcUwZWvkJAQdslulsUNatVYc1TyTyihBWYnOkfFpwP2eOjeZ8m8uY625PUyuUx0AISgrRbTPa627 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c2533ff-8313-4b96-71b4-08dab39684f5 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 19:00:28.5375 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0491 Subject: [FFmpeg-devel] [PATCH 5/7] avutil/aes: Don't use out-of-bounds index 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3l5DInnueeAY Up until now, av_aes_init() uses a->round_key[0].u8 + t as dst of memcpy where it is intended for t to be greater than 16 (u8 is an uint8_t[16]); given that round_key itself is an array, it is actually intended for dst to be in a latter round_key member. To do this properly, just cast a->round_key to unsigned char*. This fixes the srtp, aes, aes_ctr, mov-3elist-encrypted, mov-frag-encrypted and mov-tenc-only-encrypted FATE-tests with (Clang-)UBSan. Signed-off-by: Andreas Rheinhardt --- libavutil/aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/aes.c b/libavutil/aes.c index 8b78daa782..2f08fb4164 100644 --- a/libavutil/aes.c +++ b/libavutil/aes.c @@ -253,7 +253,7 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) tk[j][i] ^= sbox[tk[j - 1][i]]; } - memcpy(a->round_key[0].u8 + t, tk, KC * 4); + memcpy((unsigned char*)a->round_key + t, tk, KC * 4); } if (decrypt) { From patchwork Fri Oct 21 18:59:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38875 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp927307pzb; Fri, 21 Oct 2022 12:01:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78kdG3U5saTVec0BZFSDkH2QXOkslmGGW7fArLRkioddeq+/3jE6rOYtsdcvKroIBpWWuB X-Received: by 2002:a17:907:968d:b0:78e:1a4:131 with SMTP id hd13-20020a170907968d00b0078e01a40131mr16691592ejc.439.1666378861650; Fri, 21 Oct 2022 12:01:01 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ne37-20020a1709077ba500b0078def76da94si18027727ejc.437.2022.10.21.12.01.01; Fri, 21 Oct 2022 12:01:01 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=YgsPJXd5; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 16E3768BEE9; Fri, 21 Oct 2022 22:00:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074078.outbound.protection.outlook.com [40.92.74.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 48A5968B8C1 for ; Fri, 21 Oct 2022 22:00:43 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PHW64zvo+lYUdjrDqTS9Br6b6ujLdH8RCZSSpQM7dq3WAWbCC3Bcpc5w0CODETVgolm3PLpW0T3tGVO8tV9L9gd+773nr4Lwq0b9oB172Us6QM9vAS3nFEpTkbVlyoHeuFLM7dr8ITgxytrrikG5tLrs3u9syKYjZuTWLlbGS9SLPq1T6nxWz0rb1vKdnRicNern6pw8HCdLJQOpsEgelifIVIP+HEhgxcKCNiZ9m1XW2jOkzaX4U24C7Nl62NpmdHqLg67bJWLHHdhkN3o91VJexACOW7LK6aavfGRGSRP5bnOUi8YgIYo+JRuix9XkyVNcq5r8yB4EABpVGYbwsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=A3+dT0vFPNJJNPgIw9pDuQENr5VusOpsnNB/nKpFrog=; b=dS10f2j8OEXdaV2eoFM0evwSlQdfXBiYY3qsc29JMU0/EozyeSPofvsZm1pAwJgH6MyntW14ar3zQI5LLevjjuPktrlmvDYbxh7t+RxtGM5dHPgXuuPUFAtsdmM9Omp7WfEdxkfObdrnrEBTf4jvZSFhJxIaEvXhZGZMV5+7jOk5nHks1YfWi/HYsnmYoQc9xrJiOuA9X68wy6IolqRNFWlUc5bII6Z39fixQKF0xErJ1iQ+wzQ6KTJe7iamTyFz2sJIvbay9c45W3kcxYxjesVt9+dkIUw5Hn8CI4XbIYrlcikCKFdm6gJmuou1om7wntJlf8XEKmGc3VIiU0I3xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A3+dT0vFPNJJNPgIw9pDuQENr5VusOpsnNB/nKpFrog=; b=YgsPJXd5dJrqkQqx7EzSE/mfmEJpNqgGhlkp01anFFIIWAXV09bkQuAvAaGfcD0Tipc8eaqnxlZSI3/ZsxAcfDOUWwn5IVhekvJ2f073N9+bAZlfjipy0a1m78/JXmfu/yfLX+H11XliSusPdwj1Ko63NEToy1xy7OQmx/X3pHyp9ZIqOZkpZfEwl20/vLuyZGja00IjU6Eupg7maN3pqgEG7Q1Fn0Sn3JpPhJ0hHR7VS2gygTHWcc6tCzKSC2TcJrgv4/3/BItb77ttwyhoh5BFVroDmEjRadsvkJwD0vGHpjmWn4TqkdUticqw26YgcDgHLp38PvbLtdIAyQ9w/w== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0491.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:291::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 19:00:29 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 19:00:29 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 20:59:38 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [SL+BosalTg+56nMWLReaNmtOviDgyeMrqFXRXYcjJVE=] X-ClientProxiedBy: FR0P281CA0047.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021185939.3096155-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0491:EE_ X-MS-Office365-Filtering-Correlation-Id: fed237df-fa1a-4152-8fe8-08dab3968571 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmoyh0/rGpTlCzjnzrUxdxR9YgBmvEyerLZGkzowPvfoA2TIX0CqAsFJiXyHgILeExdehFqyK7O12r7AUxBBOYpaOlXNC9Sx40rJTFtWIyjexWvV0rynJgGAhxE5D8KQuysnAb8C9sSRctLpX6/U1gLzIWabNH8m+4wlKSpej6enSTj6YQSvOoM19LZOmmDIfdGYWdVO2E+ZpdsB2k0/In3FRvcFsup5v20SPbynnuJ+FenOZd49Djqg62qe0oiIdNwaSZoEEzySvjYfbHfX9LkmrA41ndDX9NHHAUN6N+1u9DoLg+DmQpHYZxtvpCAqLV5UxLBnAuYulWzgeHrA6x0fuMlomaBkuQvzMWqjgX14JTKODN0p5c5S63NlXmaPKdgAP1iM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nQML6QMye17fOIBp7fEtHQBhc2F4rco8i82Nb7Qfv28sRUYzfQtKF4c8GGtRY9VOwToi6MzP/3ZlK3/9PQjCm2AJJ1N+LSDT47BuxMRMSQZU34H3BiWxa/agtZy6pbAbVPHGmQfv9BQN3rQYTQk8xqE1OZKm+Bu0sN9sXIHOcTpwBD/bqIovwmU0UxNnq8WrXvBYceBeisPQ0tX1+xEKRy0fU+B7/u4+0PTtDN4LNmfoKYakdoReUFtWvo7qQrEFPFuTjq2Qsv2HNHEaPm0cA9NyD8d5FruRAFZjt5ib9tBESp4TRZD5Ew1SPun3fzPGtppDrQzleiZ/uidZ8CsgzewLHJLFtxBGUHA8EH6Bu+cjn/c= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fed237df-fa1a-4152-8fe8-08dab3968571 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 19:00:29.3500 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0491 Subject: [FFmpeg-devel] [PATCH 6/7] avutil/integer: Fix undefined left shifts of negative numbers 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: B9kq7zm3/GOM Affected the integers FATE-test. Signed-off-by: Andreas Rheinhardt --- libavutil/integer.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavutil/integer.c b/libavutil/integer.c index b709c6d487..a692c3783c 100644 --- a/libavutil/integer.c +++ b/libavutil/integer.c @@ -103,7 +103,7 @@ AVInteger av_shr_i(AVInteger a, int s){ for(i=0; i>4); unsigned int v=0; - if(index+1> (s&15); } @@ -158,11 +158,9 @@ AVInteger av_int2i(int64_t a){ } int64_t av_i2int(AVInteger a){ - int i; - int64_t out=(int8_t)a.v[AV_INTEGER_SIZE-1]; + uint64_t out = 0; - for(i= AV_INTEGER_SIZE-2; i>=0; i--){ + for (int i = 3; i >= 0; i--) out = (out<<16) + a.v[i]; - } return out; } From patchwork Fri Oct 21 18:59:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38876 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp927395pzb; Fri, 21 Oct 2022 12:01:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rrxmyyzVx+VH8IbVTIlw8sGVdg3drKNjzTl/czOUNwqLbIvnWXeN3Vvt1pFnYrk0hAo+T X-Received: by 2002:a17:907:272a:b0:791:994d:fb6a with SMTP id d10-20020a170907272a00b00791994dfb6amr16932600ejl.337.1666378871258; Fri, 21 Oct 2022 12:01:11 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hs21-20020a1709073e9500b0073d8b93700csi21377075ejc.165.2022.10.21.12.01.10; Fri, 21 Oct 2022 12:01:11 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=OTELHULn; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1ECF768BEED; Fri, 21 Oct 2022 22:00:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074078.outbound.protection.outlook.com [40.92.74.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6A9FA68BEDA for ; Fri, 21 Oct 2022 22:00:43 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cFvg8+iPnX8/O3Xpel3dOl3Le7fen4mL8y0l/qTFX1EDByShFtoBg/umwmBa3Eq2c+jBkiv/40y26xW3ROTw4bXVkTqJRJkZ93vSXjETBwTLnyy1ycsS1MNc7PNS/b/L8UCW0+vSbiWofP28S40gvP8rLzMjaOLNcZ/ubsrOrIEd+YckVVmh+HJ6e6xsatMd1A//ZnKPJxpfq0r/d2exosQSbnwdoSD9bC9eXyw0TxODNlr0S663ns1Aj7ycNUihS8Js4uRbaHlnC/eq1+E7ch2EWX1jOSa4RP3a62jq6TwI2nnAKEQ+a9fo5K4CAzhyYpS+1bwa4UiUCXOo89qrsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LmAM93CWjafGnMoU/YhLiwjbuhl757ulHpDhSJFiYaE=; b=mNGjvWz3KqYz7XxTeYemQbSWXZhJCUeBJKbDXw+9uheQyk2768hlMOvPhz6aNi5Kd5uk94PoUSi9f4/OnAEv20tUqPtJdLpoSQOuhwSbJ4uZMJQ5UZMRYo1iJig2tyaqbNiQuARhFSMpEFgqkFy4LEhvvesvLfApG9ml25MNlovtPwdGFHU0uCQdZL08YKC+pW0qlmFQ3ZZf5EvvDbjl/4/7BIC3t8kYHlTT7CGAyBYIvrw5kB8Gky57itWUm1uwLm5wNasc9uxytk+0TylcgCT2vAkgiNz0LRTJDERPYHYEsRYrgmbUUTwVBTLANls7c51MJ+w33ji6bAKZtNJklg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LmAM93CWjafGnMoU/YhLiwjbuhl757ulHpDhSJFiYaE=; b=OTELHULnmFEPKCQXr1pCaeY+aWLqlZ4JWwsUZaLF6ZNpFCTzmLSY8jjatX86iWJFpfrTt4WGKAgKU2HrRksFLaEilP/IpesTATY9TJP3Qk6Bu7DltbzIYk5udIvu4y742KmWF/kT1buZ/X+H61lTjj4sHJo3amBSXurJVvTUcn5ZtAAK6edCLcFHuF22wOcqtCWpno8BFrGhmyvXnGMnFMOF681klWAVHy35zB41Ir0h4EgkgL+oKABTy85NZHmeMINESkM+struyBjkfM7zopqvb7KT3WpHhHfQYBcyFMu5NZ3ifg8rw+xHsBaxhxXcMzfVGJn7QQhJ5I/NNo/Iag== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0491.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:291::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 19:00:30 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 19:00:30 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 20:59:39 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [TXeSS5/X1LDOjPgek8r8Mi2BLwOwnOXBwHy4pNgjmI8=] X-ClientProxiedBy: FR0P281CA0047.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021185939.3096155-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0491:EE_ X-MS-Office365-Filtering-Correlation-Id: 43713aa3-5868-45f6-9e0b-08dab39685f9 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmoyh0/rGpTlCzjnzrUxdxR9YQU+dY944oB2PJsg1WkHMzCtTU5rpjnawq0pwb8H3KfhWnifsYe8fL3ithEQTmhU/pOu5ZXRR30QBr9UTpS2wMjO0002aQFavyruxgUq2JO19TVIYt1VCQDhLYysP7B0+DwDTHzte+kXzqjvyIy4UPPn7X4prwWkdD9HB+fE1jkdnwpffC33OfmkTKgTwtFMTOObw9NJDvs8v6VMbeuNmOCpMSFFY/hz9N3kICnB6Awft+LJ/9BrtVvYBgw+RWd4ipdPWBi3146WPI5f04NPEO4FT9Dmtj3HNgPL+yatFTzv9QR5hZO/32xhVzoBqHyUEXsIM7bHjKYq/3UYjd6C5cGoPYSMRV7I5ihgsAtpVNVuyoX6jB82hLMr2PjtAO7YImRf7x0/Okne9yyvAN99j+rb+oK7wIhKidhFpEQnEdDuOqwY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VEFGF82eSclUilUdaMyhi1zxuv6KML7dc33BmflULBwkHwtvrgXAJXeqn2GCaXyp/AQa2Y4EP2/gJVuiK0MnUEK3r57hzGUaFApXJM+shxOIjnQfDgzWLyY2HvKa4knuve6nHQ8YGpcWwu8ODn4LQf4xkiZg1yALmCSUaCgQ2uE2qvJf1Q/7MwGBVEsVpcJ+xOr307HNFRqToiEh+HGmS+iV9BBAngPSxVSEIzHM3UBjx5Um0WabEk/eQErItmpK5Idu1rBzENRgopEkDX+LPe+k= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43713aa3-5868-45f6-9e0b-08dab39685f9 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 19:00:30.2728 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0491 Subject: [FFmpeg-devel] [PATCH 7/7] avutil/integer: Use '|' instead of '+' where it is more natural 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VyCrsMLwlDe2 Signed-off-by: Andreas Rheinhardt --- libavutil/integer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/integer.c b/libavutil/integer.c index a692c3783c..d0a0f62c9a 100644 --- a/libavutil/integer.c +++ b/libavutil/integer.c @@ -104,7 +104,7 @@ AVInteger av_shr_i(AVInteger a, int s){ unsigned int index= i + (s>>4); unsigned int v=0; if (index + 1 < AV_INTEGER_SIZE) v = a.v[index + 1] * (1U << 16); - if(index > (s&15); } return out; @@ -161,6 +161,6 @@ int64_t av_i2int(AVInteger a){ uint64_t out = 0; for (int i = 3; i >= 0; i--) - out = (out<<16) + a.v[i]; + out = (out << 16) | a.v[i]; return out; }