aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-05-23 10:38:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-05-23 10:38:03 -0300
commit4a00f61276a9a38b0427fbae3dbbd86dfb5a0749 (patch)
tree16ed717a2f4b79bad0743c2a8888ba55e013a309 /testes
parent42d40581dd919fb134c07027ca1ce0844c670daf (diff)
downloadlua-4a00f61276a9a38b0427fbae3dbbd86dfb5a0749.tar.gz
lua-4a00f61276a9a38b0427fbae3dbbd86dfb5a0749.tar.bz2
lua-4a00f61276a9a38b0427fbae3dbbd86dfb5a0749.zip
'lua_checkstack' doesn't need to check stack overflow
'luaD_growstack' already checks that. This commit also fixes an internal bug in 'luaD_growstack': a large 'n' could cause an arithmetic overflow when computing 'needed'.
Diffstat (limited to '')
-rw-r--r--testes/coroutine.lua15
1 files changed, 6 insertions, 9 deletions
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 76c9d6e6..15fccc30 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -741,20 +741,17 @@ _X()
741 741
742if not _soft then 742if not _soft then
743 -- bug (stack overflow) 743 -- bug (stack overflow)
744 local j = 2^9 744 local lim = 1000000 -- stack limit; assume 32-bit machine
745 local lim = 1000000 -- (C stack limit; assume 32-bit machine) 745 local t = {lim - 10, lim - 5, lim - 1, lim, lim + 1, lim + 5}
746 local t = {lim - 10, lim - 5, lim - 1, lim, lim + 1}
747 for i = 1, #t do 746 for i = 1, #t do
748 local j = t[i] 747 local j = t[i]
749 co = coroutine.create(function() 748 local co = coroutine.create(function()
750 local t = {} 749 return table.unpack({}, 1, j)
751 for i = 1, j do t[i] = i end
752 return table.unpack(t)
753 end) 750 end)
754 local r, msg = coroutine.resume(co) 751 local r, msg = coroutine.resume(co)
755 assert(not r) 752 -- must fail for unpacking larger than stack limit
753 assert(j < lim or not r)
756 end 754 end
757 co = nil
758end 755end
759 756
760 757