public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ffmpeg] epel9-next: Backport upstream patch to fix C compatibility issues
Date: Mon, 20 Jul 2026 17:31:14 GMT	[thread overview]
Message-ID: <178456867462.1.17240025055039496896.rpms-ffmpeg-b05e4ff55765@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/ffmpeg
            Branch : epel9-next
            Commit : b05e4ff5576598302a21fdd9c0c9b7c6e526f352
            Author : Florian Weimer <fweimer@redhat.com>
            Date   : 2024-01-05T15:48:35+01:00
            Stats  : +72/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/ffmpeg/c/b05e4ff5576598302a21fdd9c0c9b7c6e526f352?branch=epel9-next

            Log:
            Backport upstream patch to fix C compatibility issues

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>

---
diff --git a/ffmpeg-c99.patch b/ffmpeg-c99.patch
new file mode 100644
index 0000000..0ae4d8a
--- /dev/null
+++ b/ffmpeg-c99.patch
@@ -0,0 +1,67 @@
+From 42982b5a5d461530a792e69b3e8abdd9d6d67052 Mon Sep 17 00:00:00 2001
+From: Frank Plowman <post@frankplowman.com>
+Date: Fri, 22 Dec 2023 12:00:01 +0000
+Subject: [PATCH] avformat/ffrtmpcrypt: Fix int-conversion warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Content-type: text/plain
+
+The gcrypt definition of `bn_new` used to use the return statement
+on errors, with an AVERROR return value, regardless of the signature
+of the function where the macro is used - 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 <post@frankplowman.com>
+Signed-off-by: Martin Storsjö <martin@martin.st>
+---
+ 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
+

diff --git a/ffmpeg.spec b/ffmpeg.spec
index 48e9732..fc2de36 100644
--- a/ffmpeg.spec
+++ b/ffmpeg.spec
@@ -92,7 +92,7 @@ Name:           ffmpeg
 %global pkg_name %{name}%{?pkg_suffix}
 
 Version:        6.1.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A complete solution to record, convert and stream audio and video
 License:        GPL-3.0-or-later
 URL:            https://ffmpeg.org/
@@ -119,6 +119,7 @@ Patch2:         ffmpeg-allow-fdk-aac-free.patch
 # Drop openh264 runtime version checks
 # https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211
 Patch4:         0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch
+Patch5:         ffmpeg-c99.patch
 
 # Set up dlopen for openh264
 Patch1001:      ffmpeg-dlopen-openh264.patch
@@ -860,6 +861,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples
 %{_mandir}/man3/libswscale.3*
 
 %changelog
+* Fri Jan 05 2024 Florian Weimer <fweimer@redhat.com> - 6.1.1-2
+- Backport upstream patch to fix C compatibility issues
+
 * Thu Jan 04 2024 Neal Gompa <ngompa@fedoraproject.org> - 6.1.1-1
 - Update to 6.1.1
 

                 reply	other threads:[~2026-07-20 17:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178456867462.1.17240025055039496896.rpms-ffmpeg-b05e4ff55765@fedoraproject.org \
    --to=fweimer@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox