From f21cbba8b5822eb61e6a6d02c20fe89bdd636434 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 23 Oct 2015 12:27:44 -0400 Subject: [PATCH] Fix test --- .../arithmetic/MultiplyOneDeobfuscator.java | 2 +- .../arithmetic/MultiplyOneDeobfuscatorTest.java | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscator.java b/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscator.java index eb159a8345..bddd7d65c3 100644 --- a/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscator.java +++ b/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscator.java @@ -64,7 +64,7 @@ public class MultiplyOneDeobfuscator implements Deobfuscator if (removeIdx == -1) continue; - if (!MultiplicationDeobfuscator.isOnlyPath(e, ictx)) + if (!MultiplicationDeobfuscator.isOnlyPath(e, ictx, removeIdx == 0 ? one : two)) continue; ictx.removeStack(removeIdx); diff --git a/src/test/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscatorTest.java b/src/test/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscatorTest.java index 3fbff8fad1..183dabfe1f 100644 --- a/src/test/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscatorTest.java +++ b/src/test/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscatorTest.java @@ -11,6 +11,7 @@ import net.runelite.deob.attributes.code.instructions.IConst_1; import net.runelite.deob.attributes.code.instructions.IConst_2; import net.runelite.deob.attributes.code.instructions.IConst_3; import net.runelite.deob.attributes.code.instructions.IConst_M1; +import net.runelite.deob.attributes.code.instructions.IDiv; import net.runelite.deob.attributes.code.instructions.ILoad; import net.runelite.deob.attributes.code.instructions.IMul; import net.runelite.deob.attributes.code.instructions.IStore_0; @@ -195,26 +196,23 @@ public class MultiplyOneDeobfuscatorTest new IConst_M1(ins), new ILoad(ins, 0), new If(ins, label), - - new ILoad(ins, 0), - new IConst_1(ins), - new If(ins, label2), + + new Goto(ins, label2), label, new ILoad(ins, 1), new LDC_W(ins, -1440517609), - new IMul(ins), + new IDiv(ins), new Goto(ins, label3), label2, new ILoad(ins, 1), new LDC_W(ins, -1440517609), - new IMul(ins), + new IDiv(ins), label3, mul, - new VReturn(ins) };