PlutoLang / Pluto

A superset of Lua 5.4 with a focus on general-purpose programming.
https://pluto-lang.org
MIT License
367 stars 22 forks source link

Upvalues might not be closed #777

Closed XmiliaH closed 5 months ago

XmiliaH commented 5 months ago

In the following example the upvalue b is not closed on the continue statement leading to UB and a crash.

local tmp
local function c()
    if tmp then
        tmp()
        error('')
    end
    return 1
end

while c() do
    local b = 2
    ::x::
    if tmp then continue end
    tmp = ||->do b=nil end
    goto x
end