commit eda87f115632c9c3e234d68b422c12fc7800ab17
parent e0e406ead38443ece426cb2ff06d26180855e363
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 9 Nov 2011 17:08:31 -0200
in 'luaL_checkstack', include extra stack space in test to allow
correct execution of error routines, if necessary
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lauxlib.c b/lauxlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.c,v 1.233 2011/06/16 14:11:04 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.234 2011/07/25 17:18:49 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -330,7 +330,9 @@ LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) {
- if (!lua_checkstack(L, space)) {
+ /* keep some extra space to run error routines, if needed */
+ const int extra = 2 * LUA_MINSTACK;
+ if (!lua_checkstack(L, space + extra)) {
if (msg)
luaL_error(L, "stack overflow (%s)", msg);
else