Fixed bug: wrong stack limit when entering a coroutine
When entering a coroutine, the computation of nCcalls added 'from->nci' to correct for preallocated CallInfos, but 'nci' includes also the Callinfos already used.
This commit is contained in:
2
ldo.c
2
ldo.c
@@ -674,7 +674,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs,
|
||||
if (from == NULL)
|
||||
L->nCcalls = CSTACKTHREAD;
|
||||
else /* correct 'nCcalls' for this thread */
|
||||
L->nCcalls = getCcalls(from) + from->nci - L->nci - CSTACKCF;
|
||||
L->nCcalls = getCcalls(from) - L->nci - CSTACKCF;
|
||||
if (L->nCcalls <= CSTACKERR)
|
||||
return resume_error(L, "C stack overflow", nargs);
|
||||
luai_userstateresume(L, nargs);
|
||||
|
||||
Reference in New Issue
Block a user