From e1d8770f12542d34a3e32b825c95b93f8a341ee1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 13 Jul 2020 13:39:02 -0300 Subject: 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. --- testes/cstack.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'testes') diff --git a/testes/cstack.lua b/testes/cstack.lua index e3e14f74..4e37b988 100644 --- a/testes/cstack.lua +++ b/testes/cstack.lua @@ -105,6 +105,22 @@ do print("testing stack-overflow in recursive 'gsub'") print("\tfinal count: ", count) end +do -- bug in 5.4.0 + print("testing limits in coroutines inside deep calls") + count = 0 + local lim = 1000 + local function stack (n) + progress() + if n > 0 then return stack(n - 1) + 1 + else coroutine.wrap(function () + stack(lim) + end)() + end + end + + print(xpcall(stack, function () return "ok" end, lim)) +end + do print("testing changes in C-stack limit") -- cgit v1.2.3-55-g6feb