mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-28 10:46:08 +00:00
Fixed: #2486 decompilation timeout on infinite loop
This commit is contained in:
@@ -3652,6 +3652,13 @@ public class AVM2Code implements Cloneable {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
if ((ins.definition instanceof LabelIns) || (ins.definition instanceof DebugLineIns)) {
|
||||
ins.setIgnored(true, 0);
|
||||
if (minChangedIp == -1 || minChangedIp > i) {
|
||||
minChangedIp = i;
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
removeIgnored(body);
|
||||
@@ -3660,6 +3667,25 @@ public class AVM2Code implements Cloneable {
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes label and debugline instructions
|
||||
* @param body Method body
|
||||
* @return Number of removed instructions
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public int removeLabelsAndDebugLine(MethodBody body) throws InterruptedException {
|
||||
int cnt = 0;
|
||||
for (int i = code.size() - 1; i >= 0; i--) {
|
||||
AVM2Instruction ins = code.get(i);
|
||||
if ((ins.definition instanceof LabelIns) || (ins.definition instanceof DebugLineIns)) {
|
||||
ins.setIgnored(true, 0);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
removeIgnored(body);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces jumps to exit instructions (return, throw) with exit
|
||||
|
||||
@@ -3263,39 +3263,5 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
|
||||
return ternar;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int checkIp(int ip) {
|
||||
if (true) {
|
||||
//return ip;
|
||||
}
|
||||
/*
|
||||
Ignore label instructions
|
||||
|
||||
<pre>
|
||||
locA:
|
||||
label
|
||||
locB:
|
||||
pushbyte 1
|
||||
|
||||
=>
|
||||
|
||||
locAB:
|
||||
pushbyte 1
|
||||
</pre>
|
||||
*/
|
||||
while (ip < code.size()) {
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
if (!(ins instanceof AVM2Instruction)) {
|
||||
break;
|
||||
}
|
||||
AVM2Instruction ains = (AVM2Instruction) ins;
|
||||
if (!(ains.definition instanceof LabelIns)) {
|
||||
break;
|
||||
}
|
||||
ip++;
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,6 +631,7 @@ public final class MethodBody implements Cloneable {
|
||||
if (deobfuscate) {
|
||||
try {
|
||||
code.removeTraps(trait, method_info, body, abc, scriptIndex, classIndex, isStatic, path);
|
||||
code.removeLabelsAndDebugLine(body);
|
||||
} catch (ThreadDeath | InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
|
||||
@@ -4125,6 +4125,9 @@ public class Graph {
|
||||
}
|
||||
|
||||
GraphPart nextPart = part.nextParts.get(0);
|
||||
if (nextPart == part) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (GraphPart r : part.refs) {
|
||||
while (true) {
|
||||
|
||||
Reference in New Issue
Block a user