From patchwork Fri Mar 22 13:33:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47312 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1743:b0:1a3:ac71:9534 with SMTP id nw3csp137277pzb; Fri, 22 Mar 2024 06:33:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW2wrkyAnvBaTtKuLIDpBaK7WN0m1AHyjnBr25W/89HHrSbAD+WfpSK9co+ew91ckzDZvJ7dX5dkJ7yleW4Ab0G5i54KCPJScobdA== X-Google-Smtp-Source: AGHT+IFAefYNqIJlrxEgE1jP8Y+PkbnQJ586zu4lOtFmZaRiew9jlWJqKZiAFaWOeNAxzifVExVv X-Received: by 2002:a50:9ec2:0:b0:568:c6a2:f427 with SMTP id a60-20020a509ec2000000b00568c6a2f427mr1540030edf.27.1711114433448; Fri, 22 Mar 2024 06:33:53 -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 c20-20020a50d654000000b0056bacaac784si900697edj.602.2024.03.22.06.33.51; Fri, 22 Mar 2024 06:33:53 -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=vIsI6CLV; 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 DB2A868D5A0; Fri, 22 Mar 2024 15:33:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02olkn2035.outbound.protection.outlook.com [40.92.48.35]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F03668D50D for ; Fri, 22 Mar 2024 15:33:42 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bHOFpgLiviGi769CKoKlq/WM/FXAsaOk6ECDVKbYQkKFUUzv4k1TAqrBWStvuwBT2ADjdjNzk2PXDc9CSvGJdcJMs05bp7p4w0+bTsAeSHo+IaJ2stOW8fohCKUSrba54DHMdgQVFqvlKrJWAE47yL+Rj7IWXA0ha682MkufD4s5pQ1RfLZbdaZ+bcHICHldRD3HCTx/8KSeWUqZlvwCDSA5XyLQEdtz3YN05QmJ1zy3gLe6yc7xr+07WNLAbu59RnrCV+bwt4xUlwXIjn3DTn9ml+6N5KcAslW0RFPsDU+1wp8uhLGrq0iPacqXZdrtVEgvt9ECOqVmu87nb5Z8qw== 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=ArpVP1aBK67Yo1fV4xRWZrnk5F+oaJJUclP50zq/nkE=; b=I8It57PDqk+z0aJi7ofbdjeCKAMIV9I2QgXVHghABByJ3px8nKWYzUgTSmQ1DM9B/KG/uf3w3MDGCdGm5YmF/ihoujpCgoIPbxe32WD0z8ZWGa6L6G0j+zOS6rPWa4+7jxsH3EOzi4mD1VlBO6hZ10+XI4hv4/fGaWRkcO9t3yRlR1m+Xrv/rPsJHRW2LcM3UuhMVVRjDzIGpuJ/oXDVio2Uv21lnPd98hu1JSftJrqz20MU+skrkGxBiR4C3YXOcnHIbErsrlDPIOr501PZI/jdgOv0eBTEiO5MkA0+WwoI9/IrYAQA/6Pe/a0DFNkSOr6lgICXyUQnQcgRBr6i5w== 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=ArpVP1aBK67Yo1fV4xRWZrnk5F+oaJJUclP50zq/nkE=; b=vIsI6CLV2PoheUknP05owi9syPG7SK3lx87pp3N5J4RvRzld+xZy+NCLYyssOh1Vd0G9UlPd9qgz4I7rJ7oZvQg9YwkRKNqbZVAhsQU39JQrzIFaSf6Rc1FDNKcFiJ0uOe9YQHYsEKaYKzm4Hov+TfcloRia54iEkbtAPBGMCBZ2yVEbiD9482i9tNBFGbR11oZvKPzXlPy602dcadN73UjFxH1tk5r9Xhu8ObnjlsGbF5SIy0dwHh1rFxRfK86R2k9/bOZEWxxZhrH4mlWKx4H65mqTaB/9W3KxBX6o63ENhXr6tWgzWQKTHDM/Vk22WIRC3Irj/XGH1v+D4HQymg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0165.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:374::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.15; Fri, 22 Mar 2024 13:33:41 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d%4]) with mapi id 15.20.7386.025; Fri, 22 Mar 2024 13:33:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Mar 2024 14:33:34 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [MVYOuOjk9He/gzCB5/teml0mwDGY9dsu+cOEiu4A0KY=] X-ClientProxiedBy: FR2P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9f::12) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240322133334.191451-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0165:EE_ X-MS-Office365-Filtering-Correlation-Id: fb01fb2e-1f1f-4461-7db4-08dc4a74aff2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EBcFFrY87oaVsQFQNaBfbCCqVr7nRnR6LYfiYNvxTG9UVhBPnb7AvvyoglMclw3g5zCwtR+bKTejoFUCQKulYSCK2R+3xRFLsDARtoIoli7kc9M3IZCoffMCoIdFEzEuLz+KaDon6oRcTqBjEF+lukW0J/vAsX/RdvvnZBlTHgE6qBxNJqYrTGqpPhInrWf2O4LVy+fpO8t+XcnNA/AP67uaPo3OTY7tLiR7NwwbwlSi8vG9AE+1lo1ipnYrpSgLyrwW2kVSFiUwfEp/Ne9qF9gaZTRnZJtFEiJL2NURk6lGQGOfvBuCQIeNhE9nc1GoxjQQyImDxNdVUBZ82EN3u0Yy8TZpEyOSqfWKwg4ZF9zPVJUBDy9DbGmnobHEzwFYRyAq4gacMYgr0TVKf+UF+1JUA+nut2BzhpqTK+xYHk302kOHIP/DNYd8fiUiYvljQWuBhvKBL0WlNS+jSgW2qp7DVdViYCi8xYIUvodLP+CuRG1IXdOMOCiGKCqGOk5bUncjnlT1uPmgfAHfz3+Kdi1tDH+iXCyc5gVOVOh/XQfHTVKHQfttobHtUi4LnWlG/YSevlsbz84ZX38c4xuSxL+XrgC1SJh5c/f4tiOKM13Z4ekBll0yRHTWQx3kl6pJ X-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4b4C2n0E2e5Fo/xgPI92Nx3lspKtltghfLRL9CYuHTXv+fHiaslpqrU5Mupp7sa2nuUAIqgOrFh9SzEVezopXB77AR0FekrUeCBWh43g01inCymDIDzkdJCArT2c7rnyi7iSrjqIpxlG6IMWQWBOR9QQX5akM3+Wah8Chd7HOHSoQieS9EUCAU2qtMfWXBi2Q+aTxiwUc1/inDIEBMnM6RrbCd193itW6KJrZ3Km16DE6fiLTU1FlubaWp49HXc/kFwauu+b3Jtw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb01fb2e-1f1f-4461-7db4-08dc4a74aff2 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2024 13:33:41.0413 (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: AS8P250MB0165 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/libx265: Pass logctx as void*, not AVClass** 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: 3mipUkUb82Aj The latter need not be save, because av_log() expects to get a pointer to an AVClass-enabled structure and not only a fake object. If this function were actually be called in the following way: const AVClass *avcl = avctx->av_class; handle_mdcv(&avcl, ); the AVClass's item_name would expect to point to an actual AVCodecContext, potentially leading to a segfault. Signed-off-by: Andreas Rheinhardt --- libavcodec/libx265.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index d7620878b8..45349a85b9 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -175,7 +175,7 @@ static av_cold int libx265_param_parse_int(AVCodecContext *avctx, return 0; } -static int handle_mdcv(const AVClass **avcl, const x265_api *api, +static int handle_mdcv(void *logctx, const x265_api *api, x265_param *params, const AVMasteringDisplayMetadata *mdcv) { @@ -198,7 +198,7 @@ static int handle_mdcv(const AVClass **avcl, const x265_api *api, if (api->param_parse(params, "master-display", buf) == X265_PARAM_BAD_VALUE) { - av_log(avcl, AV_LOG_ERROR, + av_log(logctx, AV_LOG_ERROR, "Invalid value \"%s\" for param \"master-display\".\n", buf); return AVERROR(EINVAL); @@ -230,7 +230,7 @@ static int handle_side_data(AVCodecContext *avctx, const x265_api *api, if (mdcv_sd) { int ret = handle_mdcv( - &avctx->av_class, api, params, + avctx, api, params, (AVMasteringDisplayMetadata *)mdcv_sd->data); if (ret < 0) return ret;