Skip to content

Commit efc333f

Browse files
committed
removed one test case and added another one
1 parent 5c91ed7 commit efc333f

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

soot-infoflow-android/test/soot/jimple/infoflow/android/test/droidBench/ImplicitFlowTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public void runTestImplicitFlow2() throws IOException {
3434
Assert.assertEquals(2, res.size());
3535
}
3636

37+
@Ignore("Taint is on ClassA.this$0 -> ImplicitFlow3. Since leakData() is a button click and can happen multiple times, the initial Log call is inside a tainted object.")
3738
@Test(timeout = 300000)
3839
public void runTestImplicitFlow3() throws IOException {
3940
InfoflowResults res = analyzeAPKFile("ImplicitFlows/ImplicitFlow3.apk", true);

soot-infoflow/test/soot/jimple/infoflow/test/ImplicitFlowTestCode.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,43 @@ private int constantReturnInIf() {
671671
}
672672
return 0;
673673
}
674+
675+
public abstract static class AbstractClassWithFieldSetter {
676+
677+
int foo;
678+
679+
abstract public void set();
680+
681+
}
682+
683+
public static class ClassWithFieldSetterA extends AbstractClassWithFieldSetter {
684+
685+
@Override
686+
public void set() {
687+
foo = 42;
688+
}
689+
690+
}
691+
692+
public static class ClassWithFieldSetterB extends AbstractClassWithFieldSetter {
693+
694+
@Override
695+
public void set() {
696+
foo = 1704;
697+
}
698+
699+
}
700+
701+
public void dataClassSetterTest() {
702+
int tainted = TelephonyManager.getIMEI();
703+
AbstractClassWithFieldSetter clazz;
704+
if (tainted > 42)
705+
clazz = new ClassWithFieldSetterA();
706+
else
707+
clazz = new ClassWithFieldSetterB();
708+
clazz.set();
709+
ConnectionManager cm = new ConnectionManager();
710+
cm.publish(clazz.foo);
711+
}
712+
674713
}

soot-infoflow/test/soot/jimple/infoflow/test/junit/ImplicitFlowTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,4 +691,17 @@ public void nestedIfTest() {
691691
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
692692
checkInfoflow(infoflow, 1);
693693
}
694+
695+
@Test(timeout = 300000)
696+
public void dataClassSetterTest() {
697+
IInfoflow infoflow = initInfoflow();
698+
infoflow.getConfig().setInspectSinks(false);
699+
infoflow.getConfig().setCodeEliminationMode(InfoflowConfiguration.CodeEliminationMode.NoCodeElimination);
700+
701+
List<String> epoints = new ArrayList<String>();
702+
epoints.add("<soot.jimple.infoflow.test.ImplicitFlowTestCode: void dataClassSetterTest()>");
703+
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
704+
checkInfoflow(infoflow, 1);
705+
}
706+
694707
}

0 commit comments

Comments
 (0)