From patchwork Fri Dec 22 12:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Plowman X-Patchwork-Id: 45291 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6623:b0:194:e134:edd4 with SMTP id n35csp1010753pzh; Fri, 22 Dec 2023 04:02:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEalAB7OXB/XGqVV1CB8o+BTbK15R/uBFCsBKT8MsS5jRnr6jxLVovugobs7cXyx/+R7+Ua X-Received: by 2002:a17:907:9247:b0:a23:2e58:cc20 with SMTP id kb7-20020a170907924700b00a232e58cc20mr578837ejb.124.1703246537860; Fri, 22 Dec 2023 04:02:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703246537; cv=none; d=google.com; s=arc-20160816; b=QdDY76UqKhTxCymAGHcxjY/hM6Bb4p1tm5Lb+CbSsYS+XEF8//5JqhQAwn2QOJlAlk s0aH6NJ+QXxSRgGt+MEzYMeQmh2HTPLhhSx8jxdeV6dPpHxsSlceey4jihJUEqTiLDPs I/Yu4WxNUAM8yy/+7lC73SgYMeiatPAWAygOnsyzEltjgrW1CieuuRmWoM4ZD36/A8Pm pbPeKvfXooMLyziY442wRJTf9nqQVrasXOiYZyIzJrVQhNbiTqZ9qyCFlAKmiv6HXh7X Rv51jSppird/sL9xOxccTkDc/i2A9GIJrDFnMBw052FXFQCdyUSCBeBOHIS2Cp3LhA9V LIEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:mime-version:message-id:date:from :dkim-signature:delivered-to; bh=f1ak3YuVvekWDrDuB27GcdsWm/cVcIGBqDR2anbyIUg=; fh=GABYHefZpsCOOVRn8a1IgmYuOvaCu1oFlwEOjvaxWTE=; b=U/6fY4XeYT5rOqv+hpkV3tv7szMNoC4qlJwoF3HmvJm4Uugrgf0oDR1Nv4lU3UO96Z S5UUxxm9R8Wbr48WFcvt3RE3A3Av/5c8sBRn4dtNlPxKKcL0KKdluA+qNxR6NWY9l4Bp /hOL6ktVbw4NgxEDM10kwLjsF3HJi81oTrHITDOsSlYPAmtRWcIKDUIEYjpKVoMl2zzy bGHKIgJ5uy7nb4o2tZ8kIInLzSK4ZeeuBkr74Z77oIla2f3nP8YTYKIcwtYoRI6gozNq p7SWNvs8uVZCsMHCei56qEthX4vBc6Rpxgh+sH1LiENVbcALECEN3DD6wKHd0aHJTUDD UaTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@frankplowman.com header.s=s1 header.b=HWzMKksG; 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=NONE dis=NONE) header.from=frankplowman.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l22-20020a1709067d5600b00a2355010ba6si1695008ejp.1033.2023.12.22.04.01.56; Fri, 22 Dec 2023 04:02:17 -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=@frankplowman.com header.s=s1 header.b=HWzMKksG; 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=NONE dis=NONE) header.from=frankplowman.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 916F068D2DF; Fri, 22 Dec 2023 14:01:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1AD8768CF28 for ; Fri, 22 Dec 2023 14:01:46 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frankplowman.com; h=from:subject:mime-version:to:cc:content-transfer-encoding: content-type:cc:content-type:from:subject:to; s=s1; bh=GJCwSZpOrCP1NUtqprg0ufoWgW4G1e0CkJcUGpXkiU8=; b=HWzMKksG9cRbUa8FJ0ws55Q8Vq+7jof301hpdlugMeonfJNKqcyK8rf0Fb8vHnZZYylW V3Taw9uJediqpuuAMdOH43EAHc20AWDtiZabTztW1F1+E9AEUATF/ofBuNcwiIRpk1O8k0 hAbIa5NvlF/LHnH79wpA24aeg2UIxczjVQg1Q4Tmz5ck4dhCdfEuTOone/l3wc9iJ6HDkK /ViIopKWz5vYdQLOZcAxpj4HMSJIGq17Gez7keH2Pu8LPYNYg7fkvGIvkjbjsAMKTxcFAw mqKMBxyqivrsg97B1pYiPBzLrZGHysbNKGtkuYfzCVs8QJuwY0g81gT3rzyz/u7Q== Received: by filterdrecv-6b68c9f446-xmb8m with SMTP id filterdrecv-6b68c9f446-xmb8m-1-65857A41-6C 2023-12-22 12:00:01.532024511 +0000 UTC m=+5678344.891481362 Received: from localhost.localdomain (unknown) by geopod-ismtpd-11 (SG) with ESMTP id mp91JIQGRuWdH0IytMkYyA Fri, 22 Dec 2023 12:00:01.192 +0000 (UTC) From: Frank Plowman Date: Fri, 22 Dec 2023 12:00:01 +0000 (UTC) Message-ID: <20231222115959.362902-1-post@frankplowman.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-SG-EID: Uj3aYg52c+LLQjRSx2kNrre9PZxeM4UYymiuV7D/DFCrUPtmdddVVDUZk3miaVh1/JO1FFHK2V1NQv9+VwRIHP5OmBhs7a5BpmYGDS4K42eG59DB3p/MseAryuUTLsPblWGieCFM2mA2kE1q0GQnrdPwLUyvNBVYOERn+QUG/uMVJUh+kyM4DDXq0cDPwz57RAqBaOJ/7f5d/fFIIWI7/KcFvDp05e1H576MiUdCmWEgfzM2QXRFSQMleC6Ug89M To: ffmpeg-devel@ffmpeg.org X-Entity-ID: LpPALsXh5JN/Quf2dstifQ== Subject: [FFmpeg-devel] [PATCH] avformat/ffrtmpcrypt: Fix int-conversion warning 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: Frank Plowman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VNu/d7u7dVIw The gcrypt definition of `bn_new` used to use `AVERROR`, however it is called in `dh_generate_key` and `ff_dh_init` which return pointers. As a result, compiling with gcrypt and the ffrtmpcrypt protocol resulted in an int-conversion warning. GCC 14 may upgrade these to errors [1]. This patch fixes the problem by changing the macro to remove `AVERROR` and instead set `bn` to null if the allocation fails. This is the behaviour of all the other `bn_new` implementations and so the result is already checked at all the callsites. AFAICT, this should be the only change needed to get ffmpeg off Fedora's naughty list of projects with warnings which may be upgraded to errors in GCC 14 [2]. [1]: https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html [2]: https://www.mail-archive.com/devel@lists.fedoraproject.org/msg196024.html Signed-off-by: Frank Plowman --- libavformat/rtmpdh.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c index 5ddae537a1..6a6c2ccd87 100644 --- a/libavformat/rtmpdh.c +++ b/libavformat/rtmpdh.c @@ -113,15 +113,18 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) return 0; } #elif CONFIG_GCRYPT -#define bn_new(bn) \ - do { \ - if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \ - if (!gcry_check_version("1.5.4")) \ - return AVERROR(EINVAL); \ - gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \ - gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \ - } \ - bn = gcry_mpi_new(1); \ +#define bn_new(bn) \ + do { \ + if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \ + if (gcry_check_version("1.5.4")) { \ + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \ + gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \ + } \ + } \ + if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) \ + bn = gcry_mpi_new(1); \ + else \ + bn = NULL; \ } while (0) #define bn_free(bn) gcry_mpi_release(bn) #define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w)