diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-12-27 14:32:29 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-12-27 14:32:29 -0200 |
commit | ba7da13ec5938f978c37d63aa40a3e340b301f79 (patch) | |
tree | c1f22403954f6e0c6d17c8495c11509103313c9a /lapi.c | |
parent | da37ac9c7894186a0e2e0e6f1f5f00b825fd1555 (diff) | |
download | lua-ba7da13ec5938f978c37d63aa40a3e340b301f79.tar.gz lua-ba7da13ec5938f978c37d63aa40a3e340b301f79.tar.bz2 lua-ba7da13ec5938f978c37d63aa40a3e340b301f79.zip |
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.)
Diffstat (limited to '')
-rw-r--r-- | lapi.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -956,7 +956,7 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, | |||
956 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); | 956 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); |
957 | checkresults(L, nargs, nresults); | 957 | checkresults(L, nargs, nresults); |
958 | func = L->top - (nargs+1); | 958 | func = L->top - (nargs+1); |
959 | if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ | 959 | if (k != NULL && yieldable(L)) { /* need to prepare continuation? */ |
960 | L->ci->u.c.k = k; /* save continuation */ | 960 | L->ci->u.c.k = k; /* save continuation */ |
961 | L->ci->u.c.ctx = ctx; /* save context */ | 961 | L->ci->u.c.ctx = ctx; /* save context */ |
962 | luaD_call(L, func, nresults); /* do the call */ | 962 | luaD_call(L, func, nresults); /* do the call */ |
@@ -1004,7 +1004,7 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, | |||
1004 | func = savestack(L, o); | 1004 | func = savestack(L, o); |
1005 | } | 1005 | } |
1006 | c.func = L->top - (nargs+1); /* function to be called */ | 1006 | c.func = L->top - (nargs+1); /* function to be called */ |
1007 | if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */ | 1007 | if (k == NULL || !yieldable(L)) { /* no continuation or no yieldable? */ |
1008 | c.nresults = nresults; /* do a 'conventional' protected call */ | 1008 | c.nresults = nresults; /* do a 'conventional' protected call */ |
1009 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); | 1009 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); |
1010 | } | 1010 | } |