From d194bbeacd2af26e7f06e77e5218df9142363e75 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Tue, 25 Jan 2022 00:43:38 +0200 Subject: [PATCH] Fix Lua stack overflow in LUA_UpdateSprName --- src/deh_lua.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/deh_lua.c b/src/deh_lua.c index 0bd906c13..1f6a0659c 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -590,11 +590,12 @@ void LUA_UpdateSprName(const char *name, lua_Integer value) if (!lua_isnil(gL, -1)) { - lua_pop(gL, 1); lua_pushstring(gL, name); lua_pushinteger(gL, value); lua_rawset(gL, LUA_GLOBALSINDEX); } + + lua_pop(gL, 1); // pop the rawget result } int LUA_EnumLib(lua_State *L)