Feature #1330 ยป 0027-Apply-patch-6-for-lua-5.4.7.patch
dependencies/lua-5.4/Version.txt | ||
---|---|---|
(http://www.lua.org/ftp/lua-5.4.7.tar.gz)
|
||
Upstream bug fixes from https://www.lua.org/bugs.html applied:
|
||
2, 3, 5
|
||
2, 3, 5, 6
|
||
Upstream bug fixes not applicable to our tree:
|
||
1
|
||
dependencies/lua-5.4/src/ldo.c | ||
---|---|---|
setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
|
||
break;
|
||
}
|
||
case LUA_ERRERR: {
|
||
setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling"));
|
||
break;
|
||
}
|
||
case LUA_OK: { /* special case only for closing upvalues */
|
||
setnilvalue(s2v(oldtop)); /* no error message */
|
||
break;
|
||
... | ... | |
/* some space for error handling */
|
||
#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200)
|
||
/* raise an error while running the message handler */
|
||
l_noret luaD_errerr (lua_State *L) {
|
||
TString *msg = luaS_newliteral(L, "error in error handling");
|
||
setsvalue2s(L, L->top.p, msg);
|
||
L->top.p++; /* assume EXTRA_STACK */
|
||
luaD_throw(L, LUA_ERRERR);
|
||
}
|
||
/*
|
||
** Reallocate the stack to a new size, correcting all pointers into it.
|
||
** In ISO C, any pointer use after the pointer has been deallocated is
|
||
... | ... | |
a stack error; cannot grow further than that. */
|
||
lua_assert(stacksize(L) == ERRORSTACKSIZE);
|
||
if (raiseerror)
|
||
luaD_throw(L, LUA_ERRERR); /* error inside message handler */
|
||
luaD_errerr(L); /* error inside message handler */
|
||
return 0; /* if not 'raiseerror', just signal it */
|
||
}
|
||
else if (n < LUAI_MAXSTACK) { /* avoids arithmetic overflows */
|
dependencies/lua-5.4/src/ldo.h | ||
---|---|---|
/* type of protected functions, to be ran by 'runprotected' */
|
||
typedef void (*Pfunc) (lua_State *L, void *ud);
|
||
LUAI_FUNC l_noret luaD_errerr (lua_State *L);
|
||
LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
|
||
LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
|
||
const char *mode);
|
dependencies/lua-5.4/src/lstate.c | ||
---|---|---|
if (getCcalls(L) == LUAI_MAXCCALLS)
|
||
luaG_runerror(L, "C stack overflow");
|
||
else if (getCcalls(L) >= (LUAI_MAXCCALLS / 10 * 11))
|
||
luaD_throw(L, LUA_ERRERR); /* error while handling stack error */
|
||
luaD_errerr(L); /* error while handling stack error */
|
||
}
|
||