aboutsummaryrefslogtreecommitdiff
path: root/testes/events.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-03-13 15:30:52 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-03-13 15:30:52 -0300
commit22974326ca0d4f893849ce722cc1d65b3e228f42 (patch)
tree1b4cb2cad1c55edce63e9fe6e468b1833950397d /testes/events.lua
parentc931d86e98da320c71da70c16d44aa28e9755520 (diff)
downloadlua-22974326ca0d4f893849ce722cc1d65b3e228f42.tar.gz
lua-22974326ca0d4f893849ce722cc1d65b3e228f42.tar.bz2
lua-22974326ca0d4f893849ce722cc1d65b3e228f42.zip
Use after free in 'luaV_finishset'
If a metatable is a weak table, its __newindex field could be collected by an emergency collection while being used in 'luaV_finishset'. (This bug has similarities with bug 5.3.2-1, fixed in commit a272fa66.)
Diffstat (limited to '')
-rw-r--r--testes/events.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/testes/events.lua b/testes/events.lua
index 2500fbd5..7e434b1f 100644
--- a/testes/events.lua
+++ b/testes/events.lua
@@ -379,6 +379,17 @@ x = 0 .."a".."b"..c..d.."e".."f".."g"
379assert(x.val == "0abcdefg") 379assert(x.val == "0abcdefg")
380 380
381 381
382do
383 -- bug since 5.4.1 (test needs T)
384 local mt = setmetatable({__newindex={}}, {__mode='v'})
385 local t = setmetatable({}, mt)
386
387 if T then T.allocfailnext() end
388
389 -- seg. fault
390 for i=1, 10 do t[i] = 1 end
391end
392
382-- concat metamethod x numbers (bug in 5.1.1) 393-- concat metamethod x numbers (bug in 5.1.1)
383c = {} 394c = {}
384local x 395local x
@@ -481,7 +492,7 @@ assert(not pcall(function (a,b) return a[b] end, a, 10))
481assert(not pcall(function (a,b,c) a[b] = c end, a, 10, true)) 492assert(not pcall(function (a,b,c) a[b] = c end, a, 10, true))
482 493
483-- bug in 5.1 494-- bug in 5.1
484T, K, V = nil 495local T, K, V = nil
485grandparent = {} 496grandparent = {}
486grandparent.__newindex = function(t,k,v) T=t; K=k; V=v end 497grandparent.__newindex = function(t,k,v) T=t; K=k; V=v end
487 498