summary refs log tree commit diff
path: root/pkgs/development/interpreters/lua-5/5.1.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/lua-5/5.1.nix')
-rw-r--r--pkgs/development/interpreters/lua-5/5.1.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/development/interpreters/lua-5/5.1.nix b/pkgs/development/interpreters/lua-5/5.1.nix
index 1b05cb8f778..adeaa9fae7b 100644
--- a/pkgs/development/interpreters/lua-5/5.1.nix
+++ b/pkgs/development/interpreters/lua-5/5.1.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, readline }:
+{ stdenv, fetchurl, fetchpatch, readline }:
 
 let
   dsoPatch = fetchurl {
@@ -18,12 +18,18 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ readline ];
 
-  patches = if stdenv.isDarwin then [ ./5.1.darwin.patch ] else [ dsoPatch ];
+  patches = (if stdenv.isDarwin then [ ./5.1.darwin.patch ] else [ dsoPatch ])
+    ++ [(fetchpatch {
+      name = "CVE-2014-5461.patch";
+      url = "http://anonscm.debian.org/cgit/pkg-lua/lua5.1.git/plain/debian/patches/"
+        + "0004-Fix-stack-overflow-in-vararg-functions.patch?id=b75a2014db2ad65683521f7bb295bfa37b48b389";
+      sha256 = "05i5vh53d9i6dy11ibg9i9qpwz5hdm0s8bkx1d9cfcvy80cm4c7f";
+    })];
 
   configurePhase =
     if stdenv.isDarwin
     then ''
-    makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" )
+    makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" CC="$CC" )
     installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.5.1.5.dylib" INSTALL_DATA='cp -d' )
   '' else ''
     makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC" LDFLAGS="-fPIC" )