From 2a40e13a7afd87b1618335378c99577e73db3eb1 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Fri, 16 Oct 2020 13:04:28 +0000 Subject: lua: update to 5.3.6 This release contains some minor bugfixes; notably: - 2x minor Makefile fixes (not used in base) - Long brackets with a huge number of '=' overflow some internal buffer arithmetic. - Joining an upvalue with itself can cause a use-after-free crash. See here for examples: http://www.lua.org/bugs.html#5.3.5 --- src/ldebug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ldebug.c') diff --git a/src/ldebug.c b/src/ldebug.c index e1389296e9e57..bb0e1d4aceda0 100644 --- a/src/ldebug.c +++ b/src/ldebug.c @@ -133,10 +133,11 @@ static const char *upvalname (Proto *p, int uv) { static const char *findvararg (CallInfo *ci, int n, StkId *pos) { int nparams = clLvalue(ci->func)->p->numparams; - if (n >= cast_int(ci->u.l.base - ci->func) - nparams) + int nvararg = cast_int(ci->u.l.base - ci->func) - nparams; + if (n <= -nvararg) return NULL; /* no such vararg */ else { - *pos = ci->func + nparams + n; + *pos = ci->func + nparams - n; return "(*vararg)"; /* generic name for any vararg */ } } @@ -148,7 +149,7 @@ static const char *findlocal (lua_State *L, CallInfo *ci, int n, StkId base; if (isLua(ci)) { if (n < 0) /* access to vararg values? */ - return findvararg(ci, -n, pos); + return findvararg(ci, n, pos); else { base = ci->u.l.base; name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); -- cgit v1.2.3