@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
1+{ stdenv, fetchurl, fetchpatch, pkgconfig, perl, texinfo, yasm
22, hostPlatform
33/*
44 * Licensing options (yes some are listed twice, filters and such are not listed)
@@ -238,7 +238,16 @@ stdenv.mkDerivation rec {
238238 sha256 = "1vzvpx8ixy8m44f8qwp833hv253hpghybgzbc4n8b3div3j0dvmf";
239239 };
240240
241− patchPhase = ''patchShebangs .
241+ patches = [
242+ (fetchurl {
243+ name = "CVE-2017-16840.patch";
244+ url = "http://git.videolan.org/?p=ffmpeg.git;a=patch;h=a94cb36ab2ad99d3a1331c9f91831ef593d94f74";
245+ sha256 = "0zx0vh110hrykk7j863j04bx6igm2q8dlkv25mf5g4rbxafpqig3";
246+ })
247+ ];
248+
249+ prePatch = ''
250+ patchShebangs .
242251 '' + stdenv.lib.optionalString stdenv.isDarwin ''
243252 sed -i 's/#ifndef __MAC_10_11/#if 1/' ./libavcodec/audiotoolboxdec.c
244253 '' + stdenv.lib.optionalString (frei0r != null) ''