From 677994b243176c538f1f936b78604420095daed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petri=20H=C3=A4kkinen?= Date: Tue, 30 Nov 2021 18:14:28 +0200 Subject: [PATCH] Fix: luaL_sandbox leaves value on the stack (#253) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Petri Häkkinen --- VM/src/linit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VM/src/linit.cpp b/VM/src/linit.cpp index 0792c97..c93f431 100644 --- a/VM/src/linit.cpp +++ b/VM/src/linit.cpp @@ -44,7 +44,7 @@ void luaL_sandbox(lua_State* L) lua_pushliteral(L, ""); lua_getmetatable(L, -1); lua_setreadonly(L, -1, true); - lua_pop(L, 1); + lua_pop(L, 2); // set globals to readonly and activate safeenv since the env is immutable lua_setreadonly(L, LUA_GLOBALSINDEX, true);