summary refs log tree commit diff
path: root/pkgs/development/libraries/ffmpeg/4.nix
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2023-09-05 21:13:38 -0400
committerRandy Eckenrode <randy@largeandhighquality.com>2023-09-06 16:21:33 -0400
commitf2e1dad58bb2a441e062420990e9a3cdaf963550 (patch)
treeb616fc279f785b62d49bf1f26653a44a4003feec /pkgs/development/libraries/ffmpeg/4.nix
parentdba6d77ad232e3a5ffc5e281ebbada4fe0e23981 (diff)
downloadnixpkgs-f2e1dad58bb2a441e062420990e9a3cdaf963550.tar
nixpkgs-f2e1dad58bb2a441e062420990e9a3cdaf963550.tar.gz
nixpkgs-f2e1dad58bb2a441e062420990e9a3cdaf963550.tar.bz2
nixpkgs-f2e1dad58bb2a441e062420990e9a3cdaf963550.tar.lz
nixpkgs-f2e1dad58bb2a441e062420990e9a3cdaf963550.tar.xz
nixpkgs-f2e1dad58bb2a441e062420990e9a3cdaf963550.tar.zst
nixpkgs-f2e1dad58bb2a441e062420990e9a3cdaf963550.zip
ffmpeg_4: fix crash with clang 16
ffmpeg_4 crashes in `ff_seek_frame_binary` due to UB and optimizations
clang 16 performs. This is fixed upstream in ffmpeg_5, but the patch can
be made to apply to ffmpeg_4.
Diffstat (limited to 'pkgs/development/libraries/ffmpeg/4.nix')
-rw-r--r--pkgs/development/libraries/ffmpeg/4.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/development/libraries/ffmpeg/4.nix b/pkgs/development/libraries/ffmpeg/4.nix
index 905e93de7a7..5e380a1fc08 100644
--- a/pkgs/development/libraries/ffmpeg/4.nix
+++ b/pkgs/development/libraries/ffmpeg/4.nix
@@ -7,5 +7,17 @@ import ./generic.nix rec {
       url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/031f1561cd286596cdb374da32f8aa816ce3b135";
       hash = "sha256-mSnmAkoNikDpxcN+A/hpB7mUbbtcMvm4tG6gZFuroe8=";
     }
+    # The upstream patch isn’t for ffmpeg 4, but it will apply with a few tweaks.
+    # Fixes a crash when built with clang 16 due to UB in ff_seek_frame_binary.
+    {
+      name = "utils-fix_crash_in_ff_seek_frame_binary.patch";
+      url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/ab792634197e364ca1bb194f9abe36836e42f12d";
+      hash = "sha256-UxZ4VneZpw+Q/UwkEUDNdb2nOx1QnMrZ40UagspNTxI=";
+      postFetch = ''
+        substituteInPlace "$out" \
+          --replace libavformat/seek.c libavformat/utils.c \
+          --replace 'const AVInputFormat *const ' 'const AVInputFormat *'
+      '';
+    }
   ];
 }