From 6049a74729263942d4cbb1e88a1d254f0fb41ef2 Mon Sep 17 00:00:00 2001 From: Wladimir Palant Date: Fri, 27 Aug 2021 21:12:50 +0200 Subject: [PATCH] Adjusted CallRemover: when call in an assignment is removed, replace result by null --- src/info/palant/apkInstrumentation/CallRemover.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/info/palant/apkInstrumentation/CallRemover.java b/src/info/palant/apkInstrumentation/CallRemover.java index c1ff12e..a95335d 100644 --- a/src/info/palant/apkInstrumentation/CallRemover.java +++ b/src/info/palant/apkInstrumentation/CallRemover.java @@ -12,6 +12,8 @@ import soot.Body; import soot.BodyTransformer; import soot.SootMethod; +import soot.jimple.AssignStmt; +import soot.jimple.NullConstant; public class CallRemover extends BodyTransformer { @@ -40,7 +42,15 @@ protected void internalTransform(Body body, String phaseName, Map { SootMethod method = UnitParser.getInvocationMethod(unit); - return method != null && this.methodConfig.get(method) != null; + if (method != null && this.methodConfig.get(method) != null) + { + AssignStmt assignment = UnitParser.getAssignment(unit); + if (assignment != null) + assignment.setRightOp(NullConstant.v()); + else + return true; + } + return false; }); body.validate();