lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto Ierusalimschy wrote:

> For this specific bug, the problem was that 'luaG_runerror' was using

> more extra slots than it needed. The fix can be like that:

>

>

> @@ -824,8 +824,11 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {

>    va_start(argp, fmt);

>    msg = luaO_pushvfstring(L, fmt, argp);  /* format message */

>    va_end(argp);

> -  if (isLua(ci))  /* if Lua function, add source:line information */

> +  if (isLua(ci)) {  /* if Lua function, add source:line information */

>      luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci));

> +    setobjs2s(L, L->top - 2, L->top - 1);  /* remove 'msg' from the stack

> */

> +    L->top--;

> +  }

>    luaG_errormsg(L);

>  }

>

>

> -- Roberto

 

Works well after patch(*^_^*).

 

As I understand it, luaG_runerror() as a part of error handling needs to control its stack space usage artificially, but luaO_pushvfstring() and luaG_addinfo()->luaO_pushfstring() produces two imperceptible stack growths, thus causing the problem. Is this understood correctly?

 

By the way, will this patch be applied to the next release of Lua?