Blame SOURCES/lua-5.3.5-CVE-2020-24370.patch
|
|
a8bfa3 |
diff -up lua-5.3.5/src/ldebug.c.CVE-2020-24370 lua-5.3.5/src/ldebug.c
|
|
|
a8bfa3 |
--- lua-5.3.5/src/ldebug.c.CVE-2020-24370 2020-08-19 13:37:17.075859557 -0400
|
|
|
a8bfa3 |
+++ lua-5.3.5/src/ldebug.c 2020-08-19 13:38:53.117779244 -0400
|
|
|
a8bfa3 |
@@ -133,10 +133,11 @@ static const char *upvalname (Proto *p,
|
|
|
a8bfa3 |
|
|
|
a8bfa3 |
static const char *findvararg (CallInfo *ci, int n, StkId *pos) {
|
|
|
a8bfa3 |
int nparams = clLvalue(ci->func)->p->numparams;
|
|
|
a8bfa3 |
- if (n >= cast_int(ci->u.l.base - ci->func) - nparams)
|
|
|
a8bfa3 |
+ int nvararg = cast_int(ci->u.l.base - ci->func) - nparams;
|
|
|
a8bfa3 |
+ if (n <= -nvararg)
|
|
|
a8bfa3 |
return NULL; /* no such vararg */
|
|
|
a8bfa3 |
else {
|
|
|
a8bfa3 |
- *pos = ci->func + nparams + n;
|
|
|
a8bfa3 |
+ *pos = ci->func + nparams - n;
|
|
|
a8bfa3 |
return "(*vararg)"; /* generic name for any vararg */
|
|
|
a8bfa3 |
}
|
|
|
a8bfa3 |
}
|
|
|
a8bfa3 |
@@ -148,7 +149,7 @@ static const char *findlocal (lua_State
|
|
|
a8bfa3 |
StkId base;
|
|
|
a8bfa3 |
if (isLua(ci)) {
|
|
|
a8bfa3 |
if (n < 0) /* access to vararg values? */
|
|
|
a8bfa3 |
- return findvararg(ci, -n, pos);
|
|
|
a8bfa3 |
+ return findvararg(ci, n, pos);
|
|
|
a8bfa3 |
else {
|
|
|
a8bfa3 |
base = ci->u.l.base;
|
|
|
a8bfa3 |
name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
|