commit c9cb084e6c6b8029a11966e8b2fbb0dce477859a
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Thu Feb 1 10:15:28 2024 +0000
fix
ffmpeg.spec | 1 +
rf-gcc14.patch | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
---
diff --git a/ffmpeg.spec b/ffmpeg.spec
index 3b345a2..1007a0c 100644
--- a/ffmpeg.spec
+++ b/ffmpeg.spec
@@ -127,6 +127,7 @@ Source2:
https://ffmpeg.org/ffmpeg-devel.asc
# We don't endorse adding this patch but fedora insists on breaking the ffmpeg ABI
Patch0: ffmpeg-chromium.patch
Patch1:
https://src.fedoraproject.org/rpms/ffmpeg/raw/774d42a0072430fdef97ce11b40...
+Patch2:
https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/42982b5a5d46153...
Conflicts: %{name}-free
Provides: %{name}-bin = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
diff --git a/rf-gcc14.patch b/rf-gcc14.patch
new file mode 100644
index 0000000..ef855c2
--- /dev/null
+++ b/rf-gcc14.patch
@@ -0,0 +1,60 @@
+From: Frank Plowman <post(a)frankplowman.com>
+Date: Fri, 22 Dec 2023 12:00:01 +0000 (+0000)
+Subject: avformat/ffrtmpcrypt: Fix int-conversion warning
+X-Git-Url:
http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/42982b5a5d461530...
+
+avformat/ffrtmpcrypt: Fix int-conversion warning
+
+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(a)frankplowman.com>
+Signed-off-by: Martin Storsjö <martin(a)martin.st>
+---
+
+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)