viruscamp / luadec

Lua Decompiler for lua 5.1 , 5.2 and 5.3
1.14k stars 343 forks source link

Fix SETLIST without active table #80

Open half-duplex opened 3 years ago

half-duplex commented 3 years ago

Attempt to fix failures decompiling SETLIST instructions without an active table.

$ cat test.lua
local foo = {0}
print() -- to prevent optimizing to nothing
$ luac5.1 -s test.lua
$ luadec luac.out
cannot find blockend > 5 , pc = 4, f->sizecode = 6
cannot find blockend > 6 , pc = 5, f->sizecode = 6
-- Decompiled using luadec 2.2 rev: 895d923 for Lua 5.1 from https://github.com/viruscamp/luadec
-- Command line: luac.out

-- params : ...
-- function num : 0
local l_0_0 = {}
-- DECOMPILER ERROR at PC2: No list found for R0 , SetList fails

-- DECOMPILER ERROR at PC3: Overwrote pending register: R1 in 'AssignReg'

;
(0)()

I'm not sure what lua code the original decompiler code was built to handle, so I have little confidence I did not break that.