From 19daefaec5481df72d9293123e8621ce4897617e Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Sat, 9 Aug 2014 23:13:30 -0700 Subject: [PATCH] fix(util/script_state): weird crash with Lua 5.1 Signed-off-by: Leonardo de Moura --- src/util/script_state.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/script_state.cpp b/src/util/script_state.cpp index a7ce6c9e04..539dbb5edc 100644 --- a/src/util/script_state.cpp +++ b/src/util/script_state.cpp @@ -81,6 +81,8 @@ struct script_state::imp { if (g_check_interrupt_freq > 0) { lua_sethook(m_state, check_interrupted_hook, LUA_MASKCOUNT, g_check_interrupt_freq); } + if (!lua_checkstack(m_state, 1024)) + throw exception("lua_checkstack failed"); luaL_openlibs(m_state); open_exception(m_state); open_name(m_state);