Merge origin/master

This commit is contained in:
Jindra Petřík
2015-06-14 08:57:36 +02:00
4 changed files with 55 additions and 3 deletions

View File

@@ -150,7 +150,15 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple {
}
newIstructionCount += 2 * result.variables.size();
if (newIstructionCount * 2 < result.instructionsProcessed) {
boolean allValueValid = true;
for (Object value : result.variables.values()) {
if (!ActionPush.isValidValue(value)) {
allValueValid = false;
break;
}
}
if (allValueValid && newIstructionCount * 2 < result.instructionsProcessed) {
Action target = actions.get(result.idx);
Action prevAction = actions.get(i);

View File

@@ -186,6 +186,23 @@ public class ActionPush extends Action {
return surroundWithAction(baos.toByteArray(), version);
}
public static boolean isValidValue(Object value) {
if (value instanceof String) {
for (char ch : ((String) value).toCharArray()) {
if (ch == 0) {
return false;
}
}
}
if (value instanceof Long) {
long l = (Long) value;
if (l < 0x8000000 || l > 0x7ffffff) {
return false;
}
}
return true;
}
public ActionPush(Object value) {
super(0x96, 0);
this.values = new ArrayList<>();