diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-05-23 10:38:03 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-05-23 10:38:03 -0300 |
| commit | 4a00f61276a9a38b0427fbae3dbbd86dfb5a0749 (patch) | |
| tree | 16ed717a2f4b79bad0743c2a8888ba55e013a309 /testes | |
| parent | 42d40581dd919fb134c07027ca1ce0844c670daf (diff) | |
| download | lua-github-4a00f61276a9a38b0427fbae3dbbd86dfb5a0749.tar.gz | |
'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 'testes')
| -rw-r--r-- | testes/coroutine.lua | 15 |
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() if not _soft then -- bug (stack overflow) - local j = 2^9 - local lim = 1000000 -- (C stack limit; assume 32-bit machine) - local t = {lim - 10, lim - 5, lim - 1, lim, lim + 1} + local lim = 1000000 -- stack limit; assume 32-bit machine + local t = {lim - 10, lim - 5, lim - 1, lim, lim + 1, lim + 5} for i = 1, #t do local j = t[i] - co = coroutine.create(function() - local t = {} - for i = 1, j do t[i] = i end - return table.unpack(t) + local co = coroutine.create(function() + return table.unpack({}, 1, j) end) local r, msg = coroutine.resume(co) - assert(not r) + -- must fail for unpacking larger than stack limit + assert(j < lim or not r) end - co = nil end |
