From b5a58ec11e4ee6298a76d800e7fc1a1842c499ad Mon Sep 17 00:00:00 2001 From: Luigi Scarso <luigi.scarso@gmail.com> Date: Thu, 9 Feb 2017 16:52:34 +0000 Subject: [PATCH] --safer or --shell-escape set ffi=nil --- source/texk/web2c/luatexdir/lua/luainit.w | 4 ++-- source/texk/web2c/luatexdir/lua/luajitstuff.w | 4 ++++ source/texk/web2c/luatexdir/lua/luastuff.w | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/texk/web2c/luatexdir/lua/luainit.w b/source/texk/web2c/luatexdir/lua/luainit.w index ca7556420..1cd555302 100644 --- a/source/texk/web2c/luatexdir/lua/luainit.w +++ b/source/texk/web2c/luatexdir/lua/luainit.w @@ -1,6 +1,6 @@ % luainit.w % -% Copyright 2006-2016 Taco Hoekwater <taco@@luatex.org> +% Copyright 2006-2017 Taco Hoekwater <taco@@luatex.org> % % This file is part of LuaTeX. % @@ -417,7 +417,7 @@ static void parse_options(int ac, char **av) "the terms of the GNU General Public License, version 2 or (at your option)\n" "any later version. For more information about these matters, see the file\n" "named COPYING and the LuaTeX source.\n\n" - "LuaTeX is Copyright 2016 Taco Hoekwater and the LuaTeX Team.\n"); + "LuaTeX is Copyright 2017 Taco Hoekwater and the LuaTeX Team.\n"); /* *INDENT-ON* */ uexit(0); } else if (ARGUMENT_IS("credits")) { diff --git a/source/texk/web2c/luatexdir/lua/luajitstuff.w b/source/texk/web2c/luatexdir/lua/luajitstuff.w index f219d5bd6..b29de18c9 100644 --- a/source/texk/web2c/luatexdir/lua/luajitstuff.w +++ b/source/texk/web2c/luatexdir/lua/luajitstuff.w @@ -349,6 +349,10 @@ void luainterpreter(void) (void) hide_lua_value(L, "lfs", "rmdir"); (void) hide_lua_value(L, "lfs", "mkdir"); } + /* Maybe we can extend this way to the others tables, using luac. */ + if ( safer_option || ((shellenabledp == 0) || (shellenabledp == 1 && restrictedshell == 1)) ) { + (void) luaL_dostring(L,"ffi=require[[ffi]]; for k,_ in pairs(ffi) do if k~='gc' then ffi[k]=nil end ;end; ffi=nil;"); + } /* fprintf(stdout, "\nLuajitTeX default hash function type:%s\n", */ /* jithash_hashname); */ Luas = L; diff --git a/source/texk/web2c/luatexdir/lua/luastuff.w b/source/texk/web2c/luatexdir/lua/luastuff.w index 914730375..f90f0e180 100644 --- a/source/texk/web2c/luatexdir/lua/luastuff.w +++ b/source/texk/web2c/luatexdir/lua/luastuff.w @@ -310,6 +310,10 @@ void luainterpreter(void) (void) hide_lua_value(L, "lfs", "rmdir"); (void) hide_lua_value(L, "lfs", "mkdir"); } + /* Maybe we can extend this way to the others tables, using luac. */ + if ( safer_option || ((shellenabledp == 0) || (shellenabledp == 1 && restrictedshell == 1)) ) { + (void) luaL_dostring(L,"ffi=require[[ffi]]; for k,_ in pairs(ffi) do if k~='gc' then ffi[k]=nil end; end; ffi=nil;"); + } Luas = L; } -- GitLab