Skip to content

Commit 6049a74

Browse files
committed
Adjusted CallRemover: when call in an assignment is removed, replace result by null
1 parent 552fbb6 commit 6049a74

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/info/palant/apkInstrumentation/CallRemover.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import soot.Body;
1313
import soot.BodyTransformer;
1414
import soot.SootMethod;
15+
import soot.jimple.AssignStmt;
16+
import soot.jimple.NullConstant;
1517

1618
public class CallRemover extends BodyTransformer
1719
{
@@ -40,7 +42,15 @@ protected void internalTransform(Body body, String phaseName, Map<String, String
4042

4143
body.getUnits().removeIf(unit -> {
4244
SootMethod method = UnitParser.getInvocationMethod(unit);
43-
return method != null && this.methodConfig.get(method) != null;
45+
if (method != null && this.methodConfig.get(method) != null)
46+
{
47+
AssignStmt assignment = UnitParser.getAssignment(unit);
48+
if (assignment != null)
49+
assignment.setRightOp(NullConstant.v());
50+
else
51+
return true;
52+
}
53+
return false;
4454
});
4555

4656
body.validate();

0 commit comments

Comments
 (0)