matthewdean / proxy.lua

Control access to objects in pure Lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cyclical user-created tables cause stack overflows

matthewdean opened this issue · comments

Example:

local a = {}
a[1] = a
b = a -- indexing the global environment
--> stack overflow

Relevant code:

if type == 'table' then
    -- assumes table is immutable
    local value = {}
    for k,v in pairs(wrapper) do
        value[UnwrapValue(k)] = UnwrapValue(v)
    end

So it is calling UnwrapValue forever on the table. This usually doesn't happen in other cases because proxies are stored in a lookup table, so they will only be copied once.

Fixed with rewrite.