Backport Lua 5.2.2 stack overflow fix. (#7733)

This fixes the issue described in CVE-2014-5461. At this time we cannot
confirm that the original issue has a real impact on Redis, but it is
included as an extra safety measure.

(cherry picked from commit d75ad774a92bd7de0b9448be3d622d7a13b7af27)
This commit is contained in:
Yossi Gottlieb 2020-08-31 20:42:46 +03:00 committed by Oran Agra
parent 00d0d870d2
commit d2532d1335

2
deps/lua/src/ldo.c vendored
View File

@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
CallInfo *ci; CallInfo *ci;
StkId st, base; StkId st, base;
Proto *p = cl->p; Proto *p = cl->p;
luaD_checkstack(L, p->maxstacksize); luaD_checkstack(L, p->maxstacksize + p->numparams);
func = restorestack(L, funcr); func = restorestack(L, funcr);
if (!p->is_vararg) { /* no varargs? */ if (!p->is_vararg) { /* no varargs? */
base = func + 1; base = func + 1;