From patchwork Wed Feb 21 23:31:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46419 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:26a3:b0:19e:cdac:8cce with SMTP id h35csp16189pze; Wed, 21 Feb 2024 15:29:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXD4roKV+SNRciYy1QWN2bz9LrX2NgQUKCOTrvd6JCl5Vekq/Egok7iVgtxsC05gRL1MwKXTrIjwYRxmM/riz+cD1rgvU029GNbpg== X-Google-Smtp-Source: AGHT+IFu5fPCiOk4fbDWjB/8Bz5641IjYWyWlRI8i0zifX2c5ZlxfPRACDfwJCNaCwm63QSK6DLJ X-Received: by 2002:a05:6512:11eb:b0:511:8bb1:fa6e with SMTP id p11-20020a05651211eb00b005118bb1fa6emr12219604lfs.22.1708558192972; Wed, 21 Feb 2024 15:29:52 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p18-20020a1709060e9200b00a3d4883480csi4677623ejf.84.2024.02.21.15.29.51; Wed, 21 Feb 2024 15:29:52 -0800 (PST) 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=OyhFb0cg; 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 A801F68D1A2; Thu, 22 Feb 2024 01:29:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2076.outbound.protection.outlook.com [40.92.74.76]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DE07968CE10 for ; Thu, 22 Feb 2024 01:29:40 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ccn/rpkY/hS5qeS67A0fpqf4utllsK5E83R/ijiMWOKljtiapV+eho9iQq2CaEGF+eWOzaHNxZ+V/MUsTNintFgnjDkyJHMBVHqF+7dzOcfgJSzdZcHN1UKChKeizQG2KvqqKU9jf/+k2BwqoRoMAYVFc4TJ8/WQJXcHJhzDBc0Mn9bJ+1dDxGCetMWc0fKY4fOSeRN8p8D4x/M15Aq9d3ssWC1R5Dq1IMh76i4cctWizrPYL+8uZVWE7RkHCIRGAir5PHkjk5AD2mK6Rz62xJnDwwvGLZ8eH4+F/fSN3s38mh2+0qSZxVF4cGuOxJ3ZKcc+8dSwlV/mIdWOkIabYw== 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=XjKHocVoQEg/xzNedeCb2kMaDHfUo1rRMDzud5nrUBc=; b=lfN40XrRxa/2DYOMS7pK49LhTTwp0+dSOgWaT/4Mxx83y5Ye3e29OWBkjZ7glB5n6nWkGjpdd1e4jqjcH0sTlB4SZISIpylnqKL+UIDZhlymfVR4pHidu2jj9TzvPG8ogAU2IPDv8KCSHBsgBdr7+8a4Tha5KJH241SnvFjDmljSIkZWIUBwtjZy3lTc+ssYSGofifu9qANWKE/FPhFaYz7otLPuQOAXxJ3J9m9F2ijbR5twr5uHZVclhPecG5yjAioN2irePmvPWw6O8Pd0EA883b9zM7qoyc7lQ31v15iE6lG885gFcsW4XglQ1TqdmvzyK5BXE2VMUyG2S/63bQ== 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=XjKHocVoQEg/xzNedeCb2kMaDHfUo1rRMDzud5nrUBc=; b=OyhFb0cgez7Sh2nsriDqczKbj97OW7gFNrIl3xg5cqe8LeQMRFnO2E+iMqxTrctxQsORM+rx/4OrB3crtH3zBB8eVXS92J/dIHadljk9FtDoBDcRm8dVIfTvH9gjHmwiRhQ39VXn9sICdvkapp290z7EsbFynfyUFi28D0mEOLHEL8xplYa/1T3NRK9rMCQOvXAzIW6PRMSoEwGzR3fvykw6lyBgiIE9L0IVsOHFrBCsqZ/+HHgVQ+LwPpOQWKMQRgyeIgStiMGRsQ1MW5zCiagcBI1ulNcRpp/msKd5yN0pDTVsBEEa+H0WWT4BjhLwx5IYzt7tTsFofxCWvn3lgg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0258.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.21; Wed, 21 Feb 2024 23:29:39 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7292.033; Wed, 21 Feb 2024 23:29:38 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Feb 2024 00:31:28 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [yP51pG1GvvZXiCZ3Dw0JNMym9Yt1k0pb] X-ClientProxiedBy: ZR2P278CA0083.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:65::9) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240221233130.1861976-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0258:EE_ X-MS-Office365-Filtering-Correlation-Id: f962cd5f-d2d6-40ae-9a93-08dc3334f8bf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TnoELgxn60JlDh6Hcr8QzU3dVzqes8XI6HBgaixljvTqqJIaJ1HQgHO9nBroSTAvIwxSnbTb9ZZtj9AEWnYr/eQb4N4h/zScBj/k5yaj9j0WbkgNvmrRHXU1+bR2+gCwMhG6fQiR5EDQUR1KBS0hnW0Z63R9MIzS3e/FRYqL3uYtxQI13GLiLC8hR6Q9+RyKnI12SPvrwqTsZX5JYD5IHThNIfIhYm9DZ8JUlv3DsMSOh8Tv6RUxBmwbhHDQiQIBz/Y2rN/qGpQbknXAF0wWQxrrKOnOmRqX8v8opJoY1cNZVUeQyEW5zm6+LMlaCmHoh2dxh8drUZ/Ajjx5xTyGJhgSvgsUg+jn434supFo56xT2L7wC1qxzA64bcbY/fEEXZmEFr9NUEaSnd+QKQiohzKUXExwb7brLDdT0Im8MFMNKdeuWmpiS6K4fDQF7g8mqMAU8rREOZ9LzJimDZleuWk0iKb6BRTYJ/uk8iKM62depgxQY+8EEdbBaEqX2hoygMRzJuAm5+xGv2kyy3Uz5Ecy3lR9AS7lKknI0rkyZH4urNFMLcc251Eg/qqX2cs3u8hKxYulliYeEGnG/fN8e8w3l4YtEhGP+P15GVsKDkcyIB5KoAwA3WcKjwJ5he5p X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 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Z8dIM1eg9nedx06k7JzN8wrCQT/Kool8929StHvsaGI8RTX+tvvwPsYbPG/H1M3ocQmwy4/5U9aysGUBf/S9wCWcGbd1hRRUhgQ/BtZbh7i2xJVeFWS7VeOCIME6SFzZ9Ay/x4c87mfQeAYT8Jx5t8ryLIeElrjrCDWh9dgGFRtStwLUO5CZ40B/Sr0miOmbDmseARFVVnarktGV4MMKo3rdkO/4HS5SftWo32j4kc96q3pvJq+exn3qBLfaA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f962cd5f-d2d6-40ae-9a93-08dc3334f8bf X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 23:29:38.6975 (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: PR3P250MB0258 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/cbs_h266_syntax_template: Don't omit unused function parameter 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: nwKrKyfUda4P The calls to the sei_decoded_picture_hash read and write functions are performed with four pointer arguments; just because one of them is unused by the callees does not mean that they can be omitted: This is undefined behaviour. (This was not recognized because the SEI_MESSAGE_RW macro contains casts.) Signed-off-by: Andreas Rheinhardt --- I found this via UBSan test failures with Clang 17, but actually there are compiler warnings for this: -Wcast-function-type for GCC and old Clang and -Wcast-function-type in conjunction with -Wno-cast-function-type-strict (without the latter, Clang warns about conversions with different pointer types, like int (*)(void*)->int (*)(struct Foo*); the latter typically lead to UB (when used in a call), but are actually common). libavcodec/cbs_h266_syntax_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 26ee7a420b..e75f2f6971 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3430,7 +3430,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, static int FUNC(sei_decoded_picture_hash) (CodedBitstreamContext *ctx, RWContext *rw, H266RawSEIDecodedPictureHash * - current) + current, SEIMessageState *unused) { int err, c_idx, i; From patchwork Wed Feb 21 23:32:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46421 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:26a3:b0:19e:cdac:8cce with SMTP id h35csp22087pze; Wed, 21 Feb 2024 15:45:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVEBclXZoYpS/TvTRKAZqzDxtoKbKP/0gu8SygUXeC6jpZunj3pQbkz/CfmG1aXPgqz+6DMSZq5dkO0jIJ3eCZJSy0M+yMxq5srew== X-Google-Smtp-Source: AGHT+IGqr7fjJrCezksAkUwRB2HCTWXi1JnJRi614VtdL0k5s96yzY/S28B0W7SyZtlCw382tdMX X-Received: by 2002:a05:6512:128b:b0:512:d8fa:a0f2 with SMTP id u11-20020a056512128b00b00512d8faa0f2mr922142lfs.22.1708559113708; Wed, 21 Feb 2024 15:45:13 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z13-20020a05640235cd00b00564f1f8f548si1157378edc.295.2024.02.21.15.45.05; Wed, 21 Feb 2024 15:45:13 -0800 (PST) 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=NBGFX0rV; 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 E5C2968CBD3; Thu, 22 Feb 2024 01:45:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02olkn2094.outbound.protection.outlook.com [40.92.50.94]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D095968D089 for ; Thu, 22 Feb 2024 01:44:54 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b+ni1fWDKic/5WdTVIK11OGFjbUbq/JXHLq1jL3wV5z3GP+DyF4DbPJjiBTz4OtCHFQKFvIy1SVvFf1X56Li4VTxeT+K7m1ziBZG7IrmQqdnlawOaNm92Y9SLBTLU0dSNvaOeFdWDnorhlweXdbEJnxgnuPEqR49CUVkqyVi69bnc7XBUU01iBQyGqOtYxmrk/9LKrA0uHkasnctOAfCEl+tgK/4mDgbyafL1zO31M0+IL5p5P1geGGDuGXFipgH+p2jQG2iNEov0/Io151Pi7/ChM05+pnkbTUAt8nemuRzcUMaYEfTl09Yq61tRvldroiHI3t46UNSkWIB8h8SEA== 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=WczS2y1B9LiaQ5f/DxCR429GmKeJPRMLJ8xwA9GBzVQ=; b=jFtC9Sx0KrIhP1ldxY6pkEFLW4l8vLfVATX4wzcYcpEUR2+Zdq94AEyWymJwqKimkBPpXltykaR2OnPxQy/84sSdxy4V1YOq6+GlCxFSjH3RqFppmKd8PL14gNBZ9NBWxZmNyc7rP60PHJLXqCeg+mirBIz/f2qvopvmAGv5RocRL4RQxPdNCduCn7f3fRSupNfEYSkp0Vb2EG1Gpy1ogJEBJsDAMSRMk8VG2rH5sjgjCrmgnPs7i5FU91pjY5zAK1WqM5Xr2GlbNy4ob28m8jhBk1TWltb1iyw1xvuyn2VSbjLmEFHl+62asqhOquISTQ5KG3Ixk3R/wOnYGLCXeQ== 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=WczS2y1B9LiaQ5f/DxCR429GmKeJPRMLJ8xwA9GBzVQ=; b=NBGFX0rVjPOLVgjcTGRugrudQ+Qg9blOLKPb11edCwt2s1hPPk1GIr5fCbHm8K9ubbXSiy1HUnni3XnJJRHSO6IqtABA3Ik1FjF5c8SPkXOhyhU5El2Kwi2TrVJNdnEVSrrhAtKRdnIMchM7Z2EnEgnhgyWQanSVeaSIuyWxhYoKnDFMd7Yjwz63Bib7YtWFmPePsw0pJW/JKesoltSuLBAqQOa0Fcuj1PGFIgnVjqwLq+jufQwr0E1gb2VOZZ/zdLhmnFOkFb7/hqEWc0xFFFGZLYeG+qd/cjOI98d6HRZGD4eaIiMNGCia/11rxBsJdysQRUdyTJskzVQrmmPhLw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0258.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.21; Wed, 21 Feb 2024 23:30:17 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7292.033; Wed, 21 Feb 2024 23:30:17 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Feb 2024 00:32:08 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [ySkPmH2epZhQ77dtv2E4T4sAS2t2xuoDz54bmkkznaA=] X-ClientProxiedBy: ZR0P278CA0205.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:6a::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240221233209.1862129-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0258:EE_ X-MS-Office365-Filtering-Correlation-Id: 980a3a3e-ea88-46fd-1a0a-08dc33350fd0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LgyfBNcqvmv2fGhXY8m71kzhzUiJfZHId3h/TKRJ2doUTvQNQqv8lp7Dnkn8KEnShHvRNVlO/EguC8DT5N7bX+UHnlGcH01FGyt28lmf3+TGKJJ9EMr1NJw1T2da5gPVBi5oh1bUjw3iOfaQRc3k/1xT/K7M+tfA4FnfG1EV0nSO6ol+0kNNzxsTRAhW5+mb8YRiSkmHdGgLBKS3R3ngX6hR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A0ky8n7B+UA5KbPPpcydMBtRokmRUzJZa5DGjSFRuT/aR1lqSq1MOT3qFDYe0znBkoqshpUIIF7tV7Xskp/Uq85cL/FQ8fXbVPO1js/gLw3J6Oed+j8aeO6YN88nERqFDwZ+5Y3i9Nfm9R6t28y0NBTBGglkhD44rc5stMBKwhCiP4oX5yLt5Pp3RiMcmbE5nAQPPN20RWVKy014G4Cq6OqUcNF0MiN9p2Lc+GsbLyLuoSDMIX8Mz0UFqAS2ECM0yp49chTdO06KVSWHxFnYbmECDa9sieEUXIAwlyc4pQ6z+V1gapvNlG6GvECe3uk0x/K/S1dakvs2Vczt5x5O5bYai9ULy1MoGaLOjZZT+gF9TPr9rraOM50FZq4IX0gJnylAbfGnhngl2+bMlN4BVFmJXRRzfQ50qJl11OL4Cjq0sxxy+9oAzAqe5Bg/mO/83hF71hEoBbNc5sULHRMRHmo6K0g1JR44/6jy1K5L3TgxfmkNeA8PoFAVAYkEOkoumhtD/403BZA/917GP8tv9MddKwqMxbHnc10eyRiyQfUgbDxLuSheWOniMYBHmXZcJlSwGTtE/b2wE07keJmmzfUbfmxgnxeWp03Pp6bJWSsmQoJhesWLbKheeuJnhJESKF6QFQd3n4h+6BRisL+/fmXFwGv8CLBsOoPkA5+jiVfXh4QXm74lWiawfmTZxQKrsi8gdJDiu7VWQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 980a3a3e-ea88-46fd-1a0a-08dc33350fd0 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 23:30:17.2923 (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: PR3P250MB0258 Subject: [FFmpeg-devel] [PATCH 2/3] avutil/opt: Use correct function pointer type 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: mJ9ynIQ/ePZ1 av_get_sample/pix_fmt() return their respective enums and are therefore not of the type int (*)(const char*), yet they are called as-if they were of this type. This works in practice, but is actually undefined behaviour. With Clang 17 UBSan these violations are flagged, affecting lots of tests. The number of failing tests went down from 3363 to 164 here with this patch. Signed-off-by: Andreas Rheinhardt --- libavutil/opt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index d13b1ab504..0681b19896 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -444,16 +444,26 @@ static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t return 0; } +static int get_pix_fmt(const char *name) +{ + return av_get_pix_fmt(name); +} + static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst) { return set_string_fmt(obj, o, val, dst, - AV_PIX_FMT_NB, av_get_pix_fmt, "pixel format"); + AV_PIX_FMT_NB, get_pix_fmt, "pixel format"); +} + +static int get_sample_fmt(const char *name) +{ + return av_get_sample_fmt(name); } static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst) { return set_string_fmt(obj, o, val, dst, - AV_SAMPLE_FMT_NB, av_get_sample_fmt, "sample format"); + AV_SAMPLE_FMT_NB, get_sample_fmt, "sample format"); } static int set_string_dict(void *obj, const AVOption *o, const char *val, uint8_t **dst) From patchwork Wed Feb 21 23:32:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46422 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:26a3:b0:19e:cdac:8cce with SMTP id h35csp22206pze; Wed, 21 Feb 2024 15:45:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWfPUt7giYjxNK1gG+vUIz2H6o6E9uL9ekzlqyMzMjRLfuhxib8/PRguZRZ2JFQa7+ynQCH0wmrbrybMkKs56Rn9i6tmsXA7DkHOg== X-Google-Smtp-Source: AGHT+IEx2S4J1Z8xLzV5WqiGLeELZ8vX1iCzpDHrYSuSLDBiwZO90rZBEuAHIzYPyUWWsf3U87rB X-Received: by 2002:a17:906:4e97:b0:a3f:7fac:6aca with SMTP id v23-20020a1709064e9700b00a3f7fac6acamr97514eju.57.1708559129445; Wed, 21 Feb 2024 15:45:29 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d9-20020a170906344900b00a3f67171f57si363779ejb.96.2024.02.21.15.45.28; Wed, 21 Feb 2024 15:45:29 -0800 (PST) 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=JnmGf28v; 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 649F968D1B3; Thu, 22 Feb 2024 01:45:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2051.outbound.protection.outlook.com [40.92.66.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 701EF68D089 for ; Thu, 22 Feb 2024 01:45:24 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HrU1pYucYI0SswRyBwr1TrrNwC9DeUg1LUQOTcMzhdMKQMpRsrBKwL7NCjRjCr+OWau4wYhTJfeo3DifflX0V9a+qET3cqnODZaTHsuRxJz9w4FqnscSbeqde36gpYmK87UTiaVocNbVvV9bR/kUsu4c20lwC3iN5WFijOZCvDXqC72wkOeNTDM7R/4HPluHOPhKJk3EFSfuldFmOKzYXKA8Zj98x7sGuuafNo1J1P5SuMy4mSBPYbj/sdp8QDxsqjGQB9CSb8wBkdhNkMP+qf8/uWwiBzmzeU04owkr4wu8emOnl6m+dZRLiL03MzpYjQS9q0SVJqKFJI9wNqN9tw== 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=9LnnjpIERxtzgIkOP+faVUftysVvgnemv/bXG7wK7yc=; b=nYXHbXWEsmukGUs85ggtEqRvzebwr/1CNqPRDVAM3EsGlz5bHXh9TpGU/fZkaFS4krQKySYrmW0HZdej6yJ/zHpnOhymB3zJBNLJBFzLFWgHodYAYmY8ZD6+elgduQmRc86orJwmmHUZc7L4tKFZwyTmEFUjsH9WtFyCvBVS/+jslmSzQ2AjQsbFtmi57TwNDMohn3V01svKs1VGD79RvE4CoFhhr2TEteqyspjmlOHC4Fr4TluIqHIxOq5Ve8ZvhdaCx4EG2GC9pMnsyENGS1jFE4M9FH/utEAwUXFzqD4Hr1z9n2R1LV/B3BugA8WoYpfQNE2W93IQ+MjlQzS4Bg== 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=9LnnjpIERxtzgIkOP+faVUftysVvgnemv/bXG7wK7yc=; b=JnmGf28vYOy9TDq6Qu5gWkzLTXQNIvJJ6ke30Cs3Rr+9uNc/WgcKBe5I/W9uuJukpjjFTQywlPY6tRsMKMk3mip9bZvPLMqr8dF/sVPeFeGbYqkmkduAfdbhWRw+apdnuGj92SE0k7LMT3QfuNY3L3Ao0ysICtZ44iU1DTKrBb75giHr4THbPOulEaB1pc3GzuUYPKge7k2X/GcNdl57mBslpojvJ7IKemYTvqOxuo3jmjGPQTNUdHD92H16+A4fFMwB7wMuo3y0f6HEuaWhVipFXzQ8U4g0iBYxKOXuOIM/ymp0X84KZx7/3tFOMtanE8VScohPhHCFpi/h9xQuKA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0258.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.21; Wed, 21 Feb 2024 23:30:18 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7292.033; Wed, 21 Feb 2024 23:30:18 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Feb 2024 00:32:09 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [s52b4fUujbGllq6Uu0IsrJ638Q9DJVSllDcxtDkhAXM=] X-ClientProxiedBy: ZR0P278CA0205.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:6a::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240221233209.1862129-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0258:EE_ X-MS-Office365-Filtering-Correlation-Id: 8493e03e-8f85-4a63-cd44-08dc33351065 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oF0BsuLVvB30edoQBxLFWFGf3jMsIDWcdDlnqTz4O/pGiq9ciZAww+fWLUTi3IdYgGBU/hlrYYbcsRyaUdzHaCeXF3hEEst6Vv+qpTT6WJyBLZcD3CgCthUszfp3MyZQrudIhzDiUEPJVexRtJyPIQQOI3BN5q1kDzAm940V8814cK2ObchNaU7i7MCJ714LjlAmuHure3mM/F6yylVWfiO/CDiPyXjHTS33lipohaD9WLpNejPmJfiFxBRQ4zVRPzNjiYED0iPSNlqay2P6s8m+gUwMJZ0tqvUDa0tBB/Lxt19YyXBenuFfoOerfF94DzbOxn6It0FUPiVD4l0/O3cN3nL8oijhIiAYxdc+kLbmgi4HZWjgu1nzoGIBsqBr3oR0aT5LRNG6NidZhkZtJsApdcRsamdER7S2B2v28TpCxeU4hYC6KPe1PyMcytJJXMEaJIAFTomjotPcvtJfnkSQ38x47zhvOsE7u1lFWJKbAZNQqNhOQ9Oxi4vYAF5uzxZNtI36iG6+4eMcAbnbFdzeNnDtb0c32Hbfa9z2mR3ACbG4QhnACyYAjwj8eKiBLiqEHv9/iOrPYAn/mVN47NPPAKxzJBAWL33vmrQIUmrYEnCZbaE8wRjvbDst3mrU X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dNvogVCw0gXKGhW9+2liv3N50BA6QpbSanMzLcQCNMpzO5CWAFbTXvnab6C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AlgRtMRYJuxkEsFJNGnw19YLt2LUVZ9lcbocDyp8s4b3rDz70RNoMnD42i8W3Zq7OrE1/pkRK18nZi/rg9TW2XXQm1A4tQe/nSrGklFDmf8JM6LkYH0kuoxXEUZcFoRq3W0+yQYEzO0oGGkSNvWfu/Pq6ku7wqB+8uPI2ryGKtk6Um6umVbW1CFCNf4A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8493e03e-8f85-4a63-cd44-08dc33351065 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 23:30:18.2827 (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: PR3P250MB0258 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/cbs_h2645: Avoid function pointer casts, fix UB 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: 4BwZSmJyKRci The SEI message read/write functions are called via function pointers where the SEI message-specific context is passed as void*. But the actual function definitions use a pointer to their proper context in place of void*, making the calls undefined behaviour. Clang UBSan 17 warns about this. This commit fixes this by making the functions match the type of the call. This reduced the number of failing FATE tests with UBSan from 164 to 85 here. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs_h264_syntax_template.c | 24 ++++++++++----------- libavcodec/cbs_h265_syntax_template.c | 31 +++++++++++++++++---------- libavcodec/cbs_h266_syntax_template.c | 6 +++--- libavcodec/cbs_sei.h | 8 +++---- libavcodec/cbs_sei_syntax_template.c | 23 ++++++++++++-------- 5 files changed, 52 insertions(+), 40 deletions(-) diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c index 0f8bba4a0d..282cd24292 100644 --- a/libavcodec/cbs_h264_syntax_template.c +++ b/libavcodec/cbs_h264_syntax_template.c @@ -511,9 +511,9 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIBufferingPeriod *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIBufferingPeriod *current = current_; CodedBitstreamH264Context *h264 = ctx->priv_data; const H264RawSPS *sps; int err, i, length; @@ -605,9 +605,9 @@ static int FUNC(sei_pic_timestamp)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIPicTiming *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIPicTiming *current = current_; CodedBitstreamH264Context *h264 = ctx->priv_data; const H264RawSPS *sps; int err; @@ -677,9 +677,9 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIPanScanRect *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIPanScanRect *current = current_; int err, i; HEADER("Pan-Scan Rectangle"); @@ -704,9 +704,9 @@ static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_recovery_point)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIRecoveryPoint *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIRecoveryPoint *current = current_; int err; HEADER("Recovery Point"); @@ -720,9 +720,9 @@ static int FUNC(sei_recovery_point)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawFilmGrainCharacteristics *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + H264RawFilmGrainCharacteristics *current = current_; CodedBitstreamH264Context *h264 = ctx->priv_data; const H264RawSPS *sps; int err, c, i, j; @@ -803,9 +803,9 @@ static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContex } static int FUNC(sei_display_orientation)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIDisplayOrientation *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIDisplayOrientation *current = current_; int err; HEADER("Display Orientation"); diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c index 2d4b954718..53ae0cabff 100644 --- a/libavcodec/cbs_h265_syntax_template.c +++ b/libavcodec/cbs_h265_syntax_template.c @@ -1620,8 +1620,9 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw, static int FUNC(sei_buffering_period) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIBufferingPeriod *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIBufferingPeriod *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps; const H265RawHRDParameters *hrd; @@ -1730,8 +1731,9 @@ static int FUNC(sei_buffering_period) static int FUNC(sei_pic_timing) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIPicTiming *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIPicTiming *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps; const H265RawHRDParameters *hrd; @@ -1806,8 +1808,9 @@ static int FUNC(sei_pic_timing) static int FUNC(sei_pan_scan_rect) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIPanScanRect *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIPanScanRect *current = current_; int err, i; HEADER("Pan-Scan Rectangle"); @@ -1833,8 +1836,9 @@ static int FUNC(sei_pan_scan_rect) static int FUNC(sei_recovery_point) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIRecoveryPoint *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIRecoveryPoint *current = current_; int err; HEADER("Recovery Point"); @@ -1848,9 +1852,9 @@ static int FUNC(sei_recovery_point) } static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContext *rw, - H265RawFilmGrainCharacteristics *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + H265RawFilmGrainCharacteristics *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps = h265->active_sps; int err, c, i, j; @@ -1914,8 +1918,9 @@ static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContex static int FUNC(sei_display_orientation) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIDisplayOrientation *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIDisplayOrientation *current = current_; int err; HEADER("Display Orientation"); @@ -1933,8 +1938,9 @@ static int FUNC(sei_display_orientation) static int FUNC(sei_active_parameter_sets) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIActiveParameterSets *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIActiveParameterSets *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawVPS *vps; int err, i; @@ -1970,8 +1976,9 @@ static int FUNC(sei_active_parameter_sets) static int FUNC(sei_decoded_picture_hash) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIDecodedPictureHash *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIDecodedPictureHash *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps = h265->active_sps; int err, c, i; @@ -2002,8 +2009,9 @@ static int FUNC(sei_decoded_picture_hash) static int FUNC(sei_time_code) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEITimeCode *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEITimeCode *current = current_; int err, i; HEADER("Time Code"); @@ -2053,8 +2061,9 @@ static int FUNC(sei_time_code) static int FUNC(sei_alpha_channel_info) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIAlphaChannelInfo *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIAlphaChannelInfo *current = current_; int err, length; HEADER("Alpha Channel Information"); diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index e75f2f6971..8a2adeb9e4 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3428,10 +3428,10 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_decoded_picture_hash) (CodedBitstreamContext *ctx, - RWContext *rw, - H266RawSEIDecodedPictureHash * - current, SEIMessageState *unused) + RWContext *rw, void *current_, + SEIMessageState *unused) { + H266RawSEIDecodedPictureHash *current = current_; int err, c_idx, i; HEADER("Decoded Picture Hash"); diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h index 4511c506cc..6d1bed4171 100644 --- a/libavcodec/cbs_sei.h +++ b/libavcodec/cbs_sei.h @@ -126,12 +126,10 @@ typedef struct SEIMessageTypeDescriptor { SEIMessageWriteFunction write; } SEIMessageTypeDescriptor; -// Macro for the read/write pair. The clumsy cast is needed because the -// current pointer is typed in all of the read/write functions but has to -// be void here to fit all cases. +// Macro for the read/write pair. #define SEI_MESSAGE_RW(codec, name) \ - .read = (SEIMessageReadFunction) cbs_ ## codec ## _read_ ## name, \ - .write = (SEIMessageWriteFunction)cbs_ ## codec ## _write_ ## name + .read = cbs_ ## codec ## _read_ ## name, \ + .write = cbs_ ## codec ## _write_ ## name // End-of-list sentinel element. #define SEI_MESSAGE_TYPE_END { .type = -1 } diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/cbs_sei_syntax_template.c index 62dd1dabaa..16d2cbc406 100644 --- a/libavcodec/cbs_sei_syntax_template.c +++ b/libavcodec/cbs_sei_syntax_template.c @@ -18,8 +18,9 @@ static int FUNC(filler_payload) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawFillerPayload *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawFillerPayload *current = current_; int err, i; HEADER("Filler Payload"); @@ -36,8 +37,9 @@ static int FUNC(filler_payload) static int FUNC(user_data_registered) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawUserDataRegistered *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawUserDataRegistered *current = current_; int err, i, j; HEADER("User Data Registered ITU-T T.35"); @@ -68,8 +70,9 @@ static int FUNC(user_data_registered) static int FUNC(user_data_unregistered) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawUserDataUnregistered *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawUserDataUnregistered *current = current_; int err, i; HEADER("User Data Unregistered"); @@ -96,8 +99,9 @@ static int FUNC(user_data_unregistered) static int FUNC(mastering_display_colour_volume) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawMasteringDisplayColourVolume *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawMasteringDisplayColourVolume *current = current_; int err, c; HEADER("Mastering Display Colour Volume"); @@ -118,8 +122,9 @@ static int FUNC(mastering_display_colour_volume) static int FUNC(content_light_level_info) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawContentLightLevelInfo *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawContentLightLevelInfo *current = current_; int err; HEADER("Content Light Level Information"); @@ -132,9 +137,9 @@ static int FUNC(content_light_level_info) static int FUNC(alternative_transfer_characteristics) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawAlternativeTransferCharacteristics *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawAlternativeTransferCharacteristics *current = current_; int err; HEADER("Alternative Transfer Characteristics"); @@ -146,9 +151,9 @@ static int FUNC(alternative_transfer_characteristics) static int FUNC(ambient_viewing_environment) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawAmbientViewingEnvironment *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawAmbientViewingEnvironment *current = current_; static const uint16_t max_ambient_light_value = 50000; int err;