Bug: Recursion in 'getobjname' can stack overflow

'getobjname' now broken in two, a basic version that handles locals,
upvalues, and constants, and a full version, which uses the basic
version to handle table accesses (globals and fields).
This commit is contained in:
Roberto Ierusalimschy
2023-11-01 12:00:54 -03:00
parent 81e4fce530
commit 7923dbbf72
2 changed files with 87 additions and 69 deletions

View File

@@ -121,6 +121,9 @@ assert(not string.find(doit"aaa={13}; local bbbb=1; aaa[bbbb](3)", "'bbbb'"))
checkmessage("aaa={13}; local bbbb=1; aaa[bbbb](3)", "number")
checkmessage("aaa=(1)..{}", "a table value")
-- bug in 5.4.6
checkmessage("a = {_ENV = {}}; print(a._ENV.x + 1)", "field 'x'")
_G.aaa, _G.bbbb = nil
-- calls