From ba7da13ec5938f978c37d63aa40a3e340b301f79 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 27 Dec 2018 14:32:29 -0200 Subject: Changes in the control of C-stack overflow * unification of the 'nny' and 'nCcalls' counters; * external C functions ('lua_CFunction') count more "slots" in the C stack (to allow for their possible use of buffers) * added a new test script specific for C-stack overflows. (Most of those tests were already present, but concentrating them in a single script easies the task of checking whether 'LUAI_MAXCCALLS' is adequate in a system.) --- lparser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index eed8bffd..3887958e 100644 --- a/lparser.c +++ b/lparser.c @@ -367,10 +367,12 @@ static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { } -#define enterlevel(ls) luaE_incCcalls((ls)->L) - +/* +** Macros to limit the maximum recursion depth while parsing +*/ +#define enterlevel(ls) luaE_enterCcall((ls)->L) -#define leavelevel(ls) ((ls)->L->nCcalls--) +#define leavelevel(ls) luaE_exitCcall((ls)->L) /* -- cgit v1.2.3-55-g6feb