From patchwork Tue Sep 27 15:16:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38381 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp600829pzh; Tue, 27 Sep 2022 08:16:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74DfnnDbmeI+jWTgrQIZTW4d+7qUjrgn6PWYFnlmp/ZvzkUSGXijkbvnswXK1QdLt3K1r5 X-Received: by 2002:a05:6402:5cb:b0:452:e416:2bc4 with SMTP id n11-20020a05640205cb00b00452e4162bc4mr28088440edx.114.1664291795218; Tue, 27 Sep 2022 08:16:35 -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 hh23-20020a170906a95700b006ff49b183e9si1358758ejb.971.2022.09.27.08.16.34; Tue, 27 Sep 2022 08:16:35 -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=tNHwwYwl; 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 423AC68BA4D; Tue, 27 Sep 2022 18:16:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2012.outbound.protection.outlook.com [40.92.89.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 02D2B68B2D8 for ; Tue, 27 Sep 2022 18:16:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pw7niIlixM5VIRsOyllmuGH02HVskX4B2raXRYH3hnkDssm3etqQ6j9YXKwMxa6uLAfSwGOWIP7oRfHU3Elf3QcDbSOpqQzeLJT6tsUiiSHZK7IclZyezrWK97TXeFS6BG453KojkLRC8TAKyX+u/ARW5zPP7W5ZM4ixUbqu9ur1Z5jTT6WPMo8Nc2uTJHVuFZAO29kHS6GRpTZx82UmlVDBypzc7Cv9qRO2dhx8Y+S8ElYHUwUm66e4Epa2aeo0Z+ru+0f8kz3BbX4SPszvSwFj8jY0J4uuiUBzJ7LIhJVP5Ntbq3vpxjCT3+NOlEpwSoVPcGwxpc3U9/9zHSI1Dg== 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=geAbTSkc0/wTXi/n/8Aq0CVBmoYGXh/Q7pU7soBLFsk=; b=mjbt7u1FGc5vQ39lYMT83yDvIWUuHc9ojyDFZ9eNx8CHVIhXjfMV9tCe2WvtSNaz/Y+Tx7OaamoCmGwOaL8L16CIrpCpqxrNrrAvGWjwkXGpcSAuIKTB8Wfzda0W4In403HyucehswevmagjUOptKvpR+Pl8zggAHN6iSIivyfu6vqpwCh8RzDK8e3TEHn5N1B/Jz4iaOjLuptZM5o15aLg4Hpskmva8oy1BoWMkzO+l/a3bBE6MmM1O2vL0/QiClYlFYSiw3IHsFJ5psSaku5vPSAW/JtOcukXlnZNJzADTis2107ZJ+f5StWuMjjmP+AlnFkeWNpFaxOPg9cXV2w== 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=geAbTSkc0/wTXi/n/8Aq0CVBmoYGXh/Q7pU7soBLFsk=; b=tNHwwYwlBOwn446hZjydTt0IjHZ1x192eXSxv/EG/NcAbNFqsiM5pERNGK3kVviS5M06oQHpi9gNsf3XbrW2UeRqlvwA0glDNvDaKe5wo8Egi44GvN3X0pERPXCG/besNHBjY0rkFtVK/fs7axmIkrzcfKyYM/5r2eWoPyz4XLG64fkq7BA7XOtZBht/jDZ8FC1VLOweUI4Z1OAPxs12VDoIZ00XPqCkL4VnoM0JhixSeRZ1JpUq/Bovtrgt1fgB7i4SAKSAoRC9QSNIJj8PJ8vr4JlP5u+k5cVAFHWT8j/omNjCUEBevrj1erDlDqKRfFHR7Ioeo0swOYLGphBEkQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU2P250MB0349.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:27a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.15; Tue, 27 Sep 2022 15:16:22 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8%9]) with mapi id 15.20.5654.025; Tue, 27 Sep 2022 15:16:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 27 Sep 2022 17:16:20 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [4wqv1GOdLcaaiucO4An4ai0FhlrRkDysyuxJju8djDY=] X-ClientProxiedBy: ZR0P278CA0166.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::13) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220927151620.148847-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU2P250MB0349:EE_ X-MS-Office365-Filtering-Correlation-Id: 32128115-4112-4129-3930-08daa09b3c51 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmrmVovvgOUfWPXWo8ozNAk8HAHcoKj1J2AzD5n2METvQvs+URp4HEZIUtqDysXh/Azs0A3ykpdQuUQfNrvwjTSKsfEE4smkf9+HgixnUvrtEbDiFaw4B1eJYQdrB17rE/LdkHXMZooG8u1ZIe9GQ4CDKiKoZr9dXXYf2Yef7w2wIzFkbOowjKCH8Lh6FKO40Xe4e7vxbVQBFhYayeWk+8vHkQvPtI0rVt8At41ISkvCQcEf1QXhXCik6b5sQCFsPi/Y1MaV29CTmcQbr/O2tz2F8xTN/ikQTzleBLo1Vgr8bAWQ9mRCloHh8q061k+V7PR4q/yYubVL3mB+n1FegrzHKN2nBcXhPIyuL/acPFvAfOkha+JAwH8SDpAG4mOidEeqTMIWB2pdeYo7TAvW/BuML1iVJUoxfzZy95opbkTUXuS80hqPEqeUlHr84qPxy7Gb9WJGNj2fMiHuXVztivi93SdukiLSP1mR1ImiiS278TtZZ3docu7fssgEGsaWO2JAQLuKIPG31f8G/bZ6DP3wjeAlpmpzjMY8WIzE07PeHWNKucFKlKeDER8fXvSpD1bpC1Wm+fYrrfvZli24gdOO2kSGJQ8Hq3ejTAxzFYVgpSvK527ms6rHLZpMz4lKd6SQ5fEq6rvBR1Yxby3/565D9nXHC0LMFDuuCoQuoVwds3hfQ+Sk8ME+YthIuDL29lCI1Qzyz1IJhgozGlFbAq4EmrpLMzZDvIKA99LIpQZmSIYfSvh/IhhtsemUMMNMG9c= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vRCcgt1MM4ZCwd3zSSwzKFMl2tshm4aXvOOLnXXpQcLu7UZkN15qxwymEzXnJ86izTyp9oWJHLROqEiSHUk7qLY8Nx2mRslay5JSzE/Re9ydCBamWA2JbouMdPl1breeDezZKRLnGggXG9OGowbnlv4hX2HzRoANI+r0fTnJgDDIoY7htA13e3G7GGm8av9eDoCyc6iYQmfQ4WUNzMdUynhw/e++QeWdwr7W4B9yoavJzN57t7yIKoR4Q1Oxp1EOImVOhkQ0ev4dD3OmzLXJA6q8OB+VpG5O2HIW2FISygs8KxcIY0lbhsZJUpzsF0K8vjIjFTKNfoJOxrQscvDuFnMuiE0yfdc7MvBF1e5rjJ2LjBfxc5xHGDNiqK8tli4RoNJyLtYs326e6UsyNsZt8H6swt5r80Tg36rsDIvNGhSwuwcK5XUIYq4ibo0QaIsdUF6vFXcMgM9RfLQ17opIPrE/YV5N/vEvww5OBUG/aEtqepFrEe1mE+20scZxVWQPHtAIlQUyOHGpCpSWwEMyAM2B3J5UzcbillAUvDdh47i+M7OmVIN6VtcYPn15WOWVxrNChEYiSXyZyRxiLdXiQqKwP4MIXQU0uXmLY+v4zEGLuEfZKBjA/BPjP/DUEDsv+4uKAq6GHgcrQWdxhxqRxw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H8It91800Ssk2z3yaibXS34yqZaiKkJpxcBK9SgqTQowDuOpTgoZgl8wD6pu9zJSpHompLI0r7EgO3QoNMjZkCEsXjtdQK1Fd+WLbTowQR2Q/C4aiRslDryGPqkNky3ZxdA1bwMYQkV8t9vEc3OwVJboi4zKPcckVj+ieEOmFDUIrS7Ikb0MDFVrSH8D4cMhWA+Iy92nrbgCrtj6Y7KQUC0CRNG14W5OAjgIOQ0DYJCpq+OONDujv1ZydDkgbRmzILO2DKCfYMvjU93USlTPDHzO5VxmfFMUep/0hdex/1DZj5i5iW7TvY7GrZTZB9atScHzDr/UOnGTTyajfw//ktOWCUUHQaLzYQBIUyPrFmHwFZsQ7RWMqPeGxClpCED6w+Hq3MDwn4kv0LVOJ4dQW8l7X0nR3QFzuFfklxr8TXvqt3+8YvXnAdasMORVeheerkmd6aKxlqDOGqK+TEpDktGz06aKyhrDv09fCW7dBPqTiutcaFuSMCxrMaiVIntphZOozbT/cAnkTZRt1xAROjzHr577aVEMfTZmcn1oSoeCuUAF+beULYvLE5qWdDjo3GEPrEuFbwq2mrP+oEvxGpZY1wE6u3eObzNCeP0n87Akz3Va1/ofXDjWmM5C76Q0ZATy4JOmbNNR0Uq3fThsloDvGla8AsV+42ICdozYBmzf1Vg5fNwYMtvCKtIJP26UWGMF819CFuieFZZDx5Mk0oZzZetruFaSqleBu0UAY9co8bbdWdAynSeKUrpPZad5by+IVnXvVF8rYOANe3XuGRrH3VyLtxztPz9OWiNKNtlLOvq/6rBJF5FdQzPAfv7V0yVmzHN29l7XWTquA5L11VZxgKi1oxZDlRRSDHv6sdk/28g9v0FMn45dO6j4+khiJEWTaQpC82dHTWOzGWrag8K7vLBB7iSn7QcnXIFSqEWB34hQUHw5X2QTtrGoPkwk7K21Q2mDlFpJcfrQut+69Ux4o0+SudNqs4xazpb9vn9ViDIbZjsyCF6wFf9cfaFrBAeufJulNLUnTkOyiJaFCpHfrv1/uLlDcZJbDI8ekTyeyiXcSI7WV1eNEwwbk8znNp2m5ZqmQSv06b0eZ7rm5IfrqmwnL37wXncb4ioF4qBPMjUvvR3F/5UxjAFjqofR9LrJtBSZ/yffdxk6tu/O6xtoBXyiV9DmXVIJttLn5y3W94+ioUS9/yAN/l97I+bBg7/5h0Z240OF+StQL5F9fjmO6yJGwWxJLYtz5QMG+64Stzk8Cz4KtsqmBx4FgMKO4TfgK9+C9frZjfhNvV+kzohgRITHWcKeQY/QWWlrVQKRdt3xrp+tG8v6s0c04jSc X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32128115-4112-4129-3930-08daa09b3c51 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2022 15:16:22.2113 (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: DU2P250MB0349 Subject: [FFmpeg-devel] [PATCH] avocdec/cavsdsp: Fix undefined pointer arithmetic 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: 8bpz3kKkwGqr src2 is used in CAVS_SUBPIX_HV iff FULL is true (it is exactly for the egpr functions); otherwise it might be NULL. So check for FULL before doing pointer arithmetic. Fixes a "src/libavcodec/cavsdsp.c:524:1: runtime error: applying non-zero offset 8 to null pointer" from UBSan. Signed-off-by: Andreas Rheinhardt --- libavcodec/cavsdsp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libavcodec/cavsdsp.c b/libavcodec/cavsdsp.c index af46eaf8d2..69420242d6 100644 --- a/libavcodec/cavsdsp.c +++ b/libavcodec/cavsdsp.c @@ -425,13 +425,14 @@ static void OPNAME ## cavs_filt8_hv_ ## NAME(uint8_t *dst, const uint8_t *src1, \ static void OPNAME ## cavs_filt16_hv_ ## NAME(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, ptrdiff_t dstStride, ptrdiff_t srcStride)\ { \ - OPNAME ## cavs_filt8_hv_ ## NAME(dst , src1, src2 , dstStride, srcStride); \ - OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, src2+8, dstStride, srcStride); \ + OPNAME ## cavs_filt8_hv_ ## NAME(dst , src1, FULL ? src2 : NULL, dstStride, srcStride); \ + OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, FULL ? src2 + 8 : NULL, dstStride, srcStride); \ src1 += 8*srcStride;\ - src2 += 8*srcStride;\ + if (FULL) \ + src2 += 8*srcStride;\ dst += 8*dstStride;\ - OPNAME ## cavs_filt8_hv_ ## NAME(dst , src1, src2 , dstStride, srcStride); \ - OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, src2+8, dstStride, srcStride); \ + OPNAME ## cavs_filt8_hv_ ## NAME(dst , src1, FULL ? src2 : NULL, dstStride, srcStride); \ + OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, FULL ? src2 + 8 : NULL, dstStride, srcStride); \ }\ #define CAVS_MC(OPNAME, SIZE) \ @@ -492,22 +493,22 @@ static void OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, const uint8_t * \ static void OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\ {\ - OPNAME ## cavs_filt ## SIZE ## _hv_ff(dst, src, src+stride+1,stride, stride); \ + OPNAME ## cavs_filt ## SIZE ## _hv_ff(dst, src, NULL, stride, stride); \ }\ \ static void OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\ {\ - OPNAME ## cavs_filt ## SIZE ## _hv_ii(dst, src, src+stride+1,stride, stride); \ + OPNAME ## cavs_filt ## SIZE ## _hv_ii(dst, src, NULL, stride, stride); \ }\ \ static void OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\ {\ - OPNAME ## cavs_filt ## SIZE ## _hv_kk(dst, src, src+stride+1,stride, stride); \ + OPNAME ## cavs_filt ## SIZE ## _hv_kk(dst, src, NULL, stride, stride); \ }\ \ static void OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\ {\ - OPNAME ## cavs_filt ## SIZE ## _hv_qq(dst, src, src+stride+1,stride, stride); \ + OPNAME ## cavs_filt ## SIZE ## _hv_qq(dst, src, NULL, stride, stride); \ }\ #define op_put1(a, b) a = cm[((b)+4)>>3]