Skip to content

Commit e97a244

Browse files
committed
Split not all methods
1 parent 0cafb8e commit e97a244

1 file changed

Lines changed: 15 additions & 20 deletions

File tree

soot-infoflow/src/soot/jimple/infoflow/AbstractInfoflow.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@
1616
import java.util.concurrent.ThreadFactory;
1717
import java.util.concurrent.TimeUnit;
1818
import java.util.function.Supplier;
19-
import java.util.stream.Collectors;
2019

2120
import org.slf4j.Logger;
2221
import org.slf4j.LoggerFactory;
2322

24-
import com.google.common.collect.Iterators;
25-
import com.google.common.collect.Streams;
26-
2723
import heros.solver.Pair;
2824
import soot.ArrayType;
2925
import soot.Body;
@@ -501,10 +497,11 @@ protected void constructCallgraph() {
501497
// Allow the ICC manager to change the Soot Scene before we continue
502498
if (ipcManager != null)
503499
ipcManager.updateJimpleForICC();
500+
if (config.getAliasingAlgorithm() == AliasingAlgorithm.PtsBased) {
501+
502+
}
504503

505-
// We might need to patch invokedynamic instructions
506-
if (config.isPatchInvokeDynamicInstructions())
507-
patchDynamicInvokeInstructions();
504+
patchCode();
508505

509506
// Run the preprocessors
510507
for (PreAnalysisHandler tr : preProcessors)
@@ -529,15 +526,6 @@ protected void constructCallgraph() {
529526
// reasons. Do not re-run the callgraph algorithm if the host
530527
// application already provides us with a CG.
531528
if (config.getCallgraphAlgorithm() != CallgraphAlgorithm.OnDemand && !Scene.v().hasCallGraph()) {
532-
if (config.getAliasingAlgorithm() == AliasingAlgorithm.PtsBased) {
533-
//we need to split here already for the PTS to work correctly
534-
Iterator<SootMethod> allMethods = Iterators
535-
.concat(Streams.stream(Scene.v().getApplicationClasses().snapshotIterator()).map(a -> {
536-
return a.getMethods().iterator();
537-
}).collect(Collectors.toList()).iterator());
538-
splitAllBodies(allMethods);
539-
}
540-
541529
PackManager.v().getPack("wjpp").apply();
542530
PackManager.v().getPack("cg").apply();
543531
}
@@ -555,20 +543,20 @@ protected void constructCallgraph() {
555543
}
556544

557545
/**
558-
* Re-writes dynamic invocation instructions into traditional invcations
546+
* Inserts patch-code logic
559547
*/
560-
private void patchDynamicInvokeInstructions() {
548+
private void patchCode() {
561549
for (SootClass sc : Scene.v().getClasses()) {
562550
for (SootMethod sm : sc.getMethods()) {
563551
if (sm.hasActiveBody()) {
564552
Body body = sm.getActiveBody();
565-
patchDynamicInvokeInstructions(body);
553+
patchCode(body);
566554
} else if (!(sm.getSource() instanceof MethodSourceInjector) && sm.getSource() != null) {
567555
sm.setSource(new MethodSourceInjector(sm.getSource()) {
568556

569557
@Override
570558
protected void onMethodSourceLoaded(SootMethod m, Body b) {
571-
patchDynamicInvokeInstructions(b);
559+
patchCode(b);
572560
}
573561

574562
});
@@ -577,6 +565,13 @@ protected void onMethodSourceLoaded(SootMethod m, Body b) {
577565
}
578566
}
579567

568+
private void patchCode(Body body) {
569+
if (config.isPatchInvokeDynamicInstructions()) {
570+
patchDynamicInvokeInstructions(body);
571+
}
572+
FlowDroidLocalSplitter.v().transform(body);
573+
}
574+
580575
/**
581576
* Patches the dynamic invocation instructions in the given method body
582577
*

0 commit comments

Comments
 (0)