Skip to content

Commit 194b4d9

Browse files
committed
added test case
1 parent 3474096 commit 194b4d9

7 files changed

Lines changed: 113 additions & 10 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="build/classes" path="src">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="build/classes" path="res">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="build/testclasses" path="test">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="output" path="build/classes"/>
32+
</classpath>

soot-infoflow-integration/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>soot-infoflow-integration</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8
3+
encoding/res=UTF-8
4+
encoding/test=UTF-8
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
3+
org.eclipse.jdt.core.compiler.compliance=11
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.release=disabled
8+
org.eclipse.jdt.core.compiler.source=11
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

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

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,14 +1548,21 @@ class Inner {
15481548
}
15491549

15501550
Inner field = new Inner();
1551+
15511552
public void innerFieldReductionTestNegative() {
1552-
// Inner class constructor has this has an implicit parameter. Backward, here this.field.secret is tainted and
1553-
// propagated into the inner constructor. Then, inside the constructor at the following line
1554-
// this(HeapTestCode$Inner).<soot.jimple.infoflow.test.HeapTestCode$Inner: soot.jimple.infoflow.test.HeapTestCode this$0> = this$0;
1555-
// the access path this$0.<HeapTestCode: Inner field>.<Inner: String secret> is first extended to
1556-
// this(HeapTestCode$Inner).<HeapTestCode$Inner: HeapTestCode this$0>.<HeapTestCode: HeapTestCode$Inner field>.<HeapTestCode$Inner: String secret>
1553+
// Inner class constructor has this has an implicit parameter. Backward, here
1554+
// this.field.secret is tainted and
1555+
// propagated into the inner constructor. Then, inside the constructor at the
1556+
// following line
1557+
// this(HeapTestCode$Inner).<soot.jimple.infoflow.test.HeapTestCode$Inner:
1558+
// soot.jimple.infoflow.test.HeapTestCode this$0> = this$0;
1559+
// the access path this$0.<HeapTestCode: Inner field>.<Inner: String secret> is
1560+
// first extended to
1561+
// this(HeapTestCode$Inner).<HeapTestCode$Inner: HeapTestCode
1562+
// this$0>.<HeapTestCode: HeapTestCode$Inner field>.<HeapTestCode$Inner: String
1563+
// secret>
15571564
// and then reduced due to recursive types to
1558-
// this(HeapTestCode$Inner).<HeapTestCode$Inner: String secret>
1565+
// this(HeapTestCode$Inner).<HeapTestCode$Inner: String secret>
15591566
// but that case is definitely not a recursive data structure and wrong.
15601567
Inner local = new Inner();
15611568
local.secret = TelephonyManager.getDeviceId();
@@ -1571,4 +1578,19 @@ public void innerFieldReductionTestNegative2() {
15711578
ConnectionManager cm = new ConnectionManager();
15721579
cm.publish(local.secret);
15731580
}
1581+
1582+
private static class Book {
1583+
1584+
public String name;
1585+
}
1586+
1587+
public void activationStatementTest1() {
1588+
Book b = new Book();
1589+
Book a = b;
1590+
String specialName = b.name + "123";
1591+
a.name = TelephonyManager.getDeviceId();
1592+
ConnectionManager cm = new ConnectionManager();
1593+
cm.publish(specialName);
1594+
}
1595+
15741596
}

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,8 +1233,8 @@ public void aliasWithOverwriteTest4() {
12331233
@Test(timeout = 300000)
12341234
public void innerFieldReductionTestNegative() {
12351235
IInfoflow infoflow = initInfoflow();
1236-
onlyForwards(infoflow, "We lose the object sensitivity here due to the recursive data structure" +
1237-
"reduction. See also the comment above the code of innerFieldReductionTestNegative.");
1236+
onlyForwards(infoflow, "We lose the object sensitivity here due to the recursive data structure"
1237+
+ "reduction. See also the comment above the code of innerFieldReductionTestNegative.");
12381238
List<String> epoints = new ArrayList<String>();
12391239
epoints.add("<soot.jimple.infoflow.test.HeapTestCode: void innerFieldReductionTestNegative()>");
12401240
infoflow.computeInfoflow(appPath, libPath, new SequentialEntryPointCreator(epoints), sources, sinks);
@@ -1244,11 +1244,21 @@ public void innerFieldReductionTestNegative() {
12441244
@Test(timeout = 300000)
12451245
public void innerFieldReductionTestNegative2() {
12461246
IInfoflow infoflow = initInfoflow();
1247-
onlyBackwards(infoflow, "We lose the object sensitivity here due to the recursive data structure" +
1248-
"reduction. See also the comment above the code of innerFieldReductionTestNegative.");
1247+
onlyBackwards(infoflow, "We lose the object sensitivity here due to the recursive data structure"
1248+
+ "reduction. See also the comment above the code of innerFieldReductionTestNegative.");
12491249
List<String> epoints = new ArrayList<String>();
12501250
epoints.add("<soot.jimple.infoflow.test.HeapTestCode: void innerFieldReductionTestNegative2()>");
12511251
infoflow.computeInfoflow(appPath, libPath, new SequentialEntryPointCreator(epoints), sources, sinks);
12521252
negativeCheckInfoflow(infoflow);
12531253
}
1254+
1255+
@Test(timeout = 300000)
1256+
public void activationStatementTest1() {
1257+
IInfoflow infoflow = initInfoflow();
1258+
List<String> epoints = new ArrayList<String>();
1259+
epoints.add("<soot.jimple.infoflow.test.HeapTestCode: void activationStatementTest1()>");
1260+
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
1261+
negativeCheckInfoflow(infoflow);
1262+
}
1263+
12541264
}

0 commit comments

Comments
 (0)