invalid jump fix

This commit is contained in:
2015-07-04 20:47:07 +02:00
parent 9893296f1d
commit 6cafe970fb
7 changed files with 37 additions and 9 deletions
@@ -61,6 +61,7 @@ public class ScriptPack extends AS3ClassTreeItem {
public final List<Integer> traitIndices;
private final ClassPath path;
public boolean isSimple = false;
@Override
@@ -190,7 +191,7 @@ public class ScriptPack extends AS3ClassTreeItem {
} catch (TimeoutException ex) {
writer.continueMeasure();
logger.log(Level.SEVERE, "Decompilation error", ex);
Helper.appendTimeoutComment(writer, timeout);
Helper.appendTimeoutCommentAs3(writer, timeout, 0);
return;
} catch (ExecutionException ex) {
writer.continueMeasure();
@@ -1149,9 +1149,11 @@ public class AVM2Code implements Cloneable {
posCache = new ArrayList<>();
long a = 0;
for (int i = 0; i < code.size(); i++) {
posCache.add(a);
a += code.get(i).getBytesLength();
AVM2Instruction ins = code.get(i);
posCache.add(ins.offset);
a = ins.offset + ins.getBytesLength();
}
posCache.add(a);
cacheActual = true;
}
@@ -1830,6 +1832,9 @@ public class AVM2Code implements Cloneable {
if (targetAddress > endOffset) {
return (int) (offset - targetAddress + endOffset);
}
if (targetAddress < 0) {
return (int) (offset - targetAddress);
}
return offset;
}
@@ -2228,7 +2233,7 @@ public class AVM2Code implements Cloneable {
}
while (ip < code.size()) {
if (!refs.containsKey(ip)) {
refs.put(ip, new ArrayList<Integer>());
refs.put(ip, new ArrayList<>());
}
refs.get(ip).add(lastIp);
lastIp = ip;
@@ -2276,7 +2281,7 @@ public class AVM2Code implements Cloneable {
public HashMap<Integer, List<Integer>> visitCode(MethodBody body) throws InterruptedException {
HashMap<Integer, List<Integer>> refs = new HashMap<>();
for (int i = 0; i < code.size(); i++) {
refs.put(i, new ArrayList<Integer>());
refs.put(i, new ArrayList<>());
}
visitCode(0, 0, refs);
int pos = 0;
@@ -316,7 +316,7 @@ public final class MethodBody implements Cloneable {
//writer.endMethod();
} else if (convertException instanceof TimeoutException) {
// exception was logged in convert method
Helper.appendTimeoutComment(writer, timeout);
Helper.appendTimeoutCommentAs3(writer, timeout, getCode().code.size());
} else {
// exception was logged in convert method
Helper.appendErrorComment(writer, convertException);