From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id CF976489CB for ; Fri, 22 Dec 2023 12:01:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 63F0168D2DD; Fri, 22 Dec 2023 14:01:53 +0200 (EET) 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: =?us-ascii?Q?Uj3aYg52c+LLQjRSx2kNrre9PZxeM4UYymiuV7D=2FDFCrUPtmdddVVDUZk3miaV?= =?us-ascii?Q?h1=2FJO1FFHK2V1NQv9+VwRIHP5OmBhs7a5BpmYGD?= =?us-ascii?Q?S4K42eG59DB3p=2FMseAryuUTLsPblWGieCFM2mA2?= =?us-ascii?Q?kE1q0GQnrdPwLUyvNBVYOERn+QUG=2FuMVJUh+kyM?= =?us-ascii?Q?4DDXq0cDPwz57RAqBaOJ=2F7f5d=2FfFIIWI7=2FKcFvD?= =?us-ascii?Q?p05e1H576MiUdCmWEgfzM2QXRFSQMleC6Ug89M?= 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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) -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".