Skip to content

Commit 2f6be64

Browse files
committed
Add an Android test case using String.format
1 parent dc60e01 commit 2f6be64

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<java.net.URL: void <init>(java.lang.String)> -> _SINK_
2+
<android.location.Location: double getLatitude()> -> _SOURCE_
3+
<android.location.Location: double getLongitude()> -> _SOURCE_

soot-infoflow-integration/test/soot/jimple/infoflow/collections/test/junit/AndroidTests.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@ protected void setConfiguration(InfoflowConfiguration config) {
2121

2222
}
2323

24+
@Test
25+
public void testGeoLocation() throws IOException {
26+
File rootDir = getIntegrationRoot();
27+
SetupApplication app = initApplication(new File(rootDir, "testAPKs/CoordinatesToURLParameter.apk"));
28+
app.getConfig().getPathConfiguration()
29+
.setPathReconstructionMode(InfoflowConfiguration.PathReconstructionMode.Fast);
30+
InfoflowResults results = app.runInfoflow(new File(rootDir, "SourcesAndSinks_GeoLocationNetworkOnly.txt"));
31+
Assert.assertEquals(1, results.size());
32+
33+
DataFlowResult res = results.getResultSet().stream().findFirst().get();
34+
boolean found = false;
35+
for (Stmt stmt : res.getSource().getPath()) {
36+
if (stmt.containsInvokeExpr()) {
37+
String sig = stmt.getInvokeExpr().getMethod().getSignature();
38+
if (sig.contains("android.location.Location: double")) {
39+
found = true;
40+
}
41+
}
42+
}
43+
Assert.assertTrue(found);
44+
}
45+
2446
@Test
2547
public void testResourceResolving() throws IOException {
2648
File rootDir = getIntegrationRoot();
1.57 MB
Binary file not shown.

0 commit comments

Comments
 (0)