Bail out if const param detects a lvt store
This commit is contained in:
@@ -260,6 +260,16 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
|
|
||||||
for (InstructionContext ins : frame.getInstructions())
|
for (InstructionContext ins : frame.getInstructions())
|
||||||
{
|
{
|
||||||
|
if (ins.getInstruction() instanceof LVTInstruction)
|
||||||
|
{
|
||||||
|
LVTInstruction lvt = (LVTInstruction) ins.getInstruction();
|
||||||
|
|
||||||
|
if (lvt.getVariableIndex() == lvtIndex && lvt.store())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(ins.getInstruction() instanceof ComparisonInstruction))
|
if (!(ins.getInstruction() instanceof ComparisonInstruction))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -331,19 +341,22 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
{
|
{
|
||||||
Method method;
|
Method method;
|
||||||
int lvtIndex;
|
int lvtIndex;
|
||||||
|
int paramIndex;
|
||||||
|
|
||||||
public MethodLvtPair(Method method, int lvtIndex)
|
public MethodLvtPair(Method method, int lvtIndex, int paramIndex)
|
||||||
{
|
{
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.lvtIndex = lvtIndex;
|
this.lvtIndex = lvtIndex;
|
||||||
|
this.paramIndex = paramIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
int hash = 7;
|
int hash = 5;
|
||||||
hash = 41 * hash + Objects.hashCode(this.method);
|
hash = 31 * hash + Objects.hashCode(this.method);
|
||||||
hash = 41 * hash + this.lvtIndex;
|
hash = 31 * hash + this.lvtIndex;
|
||||||
|
hash = 31 * hash + this.paramIndex;
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,6 +376,9 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
if (this.lvtIndex != other.lvtIndex) {
|
if (this.lvtIndex != other.lvtIndex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.paramIndex != other.paramIndex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +396,7 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
{
|
{
|
||||||
for (Method method : cmp.methods)
|
for (Method method : cmp.methods)
|
||||||
{
|
{
|
||||||
MethodLvtPair pair = new MethodLvtPair(method, cmp.lvtIndex);
|
MethodLvtPair pair = new MethodLvtPair(method, cmp.lvtIndex, cmp.paramIndex);
|
||||||
|
|
||||||
if (invalidDeadops.contains(pair))
|
if (invalidDeadops.contains(pair))
|
||||||
continue;
|
continue;
|
||||||
@@ -388,6 +404,16 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
// the dead comparisons must be the same and branch the same way for every call to this method.
|
// the dead comparisons must be the same and branch the same way for every call to this method.
|
||||||
List<LogicallyDeadOp> deadOps = isLogicallyDead(execution, method, cmp.lvtIndex, cmp.value);
|
List<LogicallyDeadOp> deadOps = isLogicallyDead(execution, method, cmp.lvtIndex, cmp.value);
|
||||||
|
|
||||||
|
if (deadOps == null)
|
||||||
|
{
|
||||||
|
deadops.remove(pair);
|
||||||
|
invalidDeadops.add(pair);
|
||||||
|
continue; // lvt store
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deadOps.isEmpty())
|
||||||
|
continue; // no ops to compare
|
||||||
|
|
||||||
// this must be per method,lvtindex
|
// this must be per method,lvtindex
|
||||||
List<LogicallyDeadOp> existing = deadops.get(pair);
|
List<LogicallyDeadOp> existing = deadops.get(pair);
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user