atrexus / unluau

A decompiler for Luau (Roblox's Lua based programming language: https://luau-lang.org/).
Apache License 2.0
87 stars 21 forks source link

v2 "Index was outside the bounds of the array." exception #51

Open ChloeDoesThings opened 7 months ago

ChloeDoesThings commented 7 months ago

Hello, I wanted to report a bug on v2 where you guys can hopefully fix it. Every time I try to decompile certain bytecode files, it just gives me a bunch of "Index was outside the bounds of the array." exceptions and never seems to finish.

It comes from the LiftBasicBlock function and more specifically this line of code: var instruction = Instructions[pc];

The error is caused by the pc value being less than 0 for some weird reason. All I did to my v2 fork is update the opcodes table.

Maybe you guys can fix this, thanks.

image

ChloeDoesThings commented 7 months ago

Bytecode if you need it:

input.txt

ChloeDoesThings commented 7 months ago

Update: It is caused by instructions (like JUMPIFNOT) having a D value of a negative number

image