https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-5461
https://www.lua.org/bugs.html#5.2.2-1

--- a/src/ldo.c
+++ b/src/ldo.c
@@ -274,7 +274,7 @@
     CallInfo *ci;
     StkId st, base;
     Proto *p = cl->p;
-    luaD_checkstack(L, p->maxstacksize);
+    luaD_checkstack(L, p->maxstacksize + p->numparams);
     func = restorestack(L, funcr);
     if (!p->is_vararg) {  /* no varargs? */
       base = func + 1;
