Skip to content

Commit

Permalink
Disassembler robustness against invalid CLOSURE (with inline upvalues)
Browse files Browse the repository at this point in the history
  • Loading branch information
tehtmi committed Mar 19, 2021
1 parent 2a6d955 commit aea1730
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/unluac/decompile/Code.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ public Code(LFunction function) {
for(int i = 0; i < length; i++) {
int line = i + 1;
if(op(line) == Op.CLOSURE) {
int nups = function.functions[Bx(line)].numUpvalues;
for(int j = 1; j <= nups; j++) {
upvalue[i + j] = true;
int f = Bx(line);
if(f < function.functions.length) {
int nups = function.functions[f].numUpvalues;
for(int j = 1; j <= nups; j++) {
if(i + j < length) {
upvalue[i + j] = true;
}
}
}
}
}
Expand Down

0 comments on commit aea1730

Please sign in to comment.