Skip to content

Commit eb1dc48

Browse files
committed
Merge branch 'develop' of github.com:secure-software-engineering/FlowDroid into develop
2 parents 194b4d9 + 733a609 commit eb1dc48

91 files changed

Lines changed: 1831 additions & 1430 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

soot-infoflow-android/SourcesAndSinks.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,6 @@
306306
<java.io.OutputStream: void write(byte[],int,int)> -> _SINK_
307307
<java.io.OutputStream: void write(int)> -> _SINK_
308308

309-
<java.io.FileOutputStream: void write(byte[])> -> _SINK_
310-
<java.io.FileOutputStream: void write(byte[],int,int)> -> _SINK_
311-
<java.io.FileOutputStream: void write(int)> -> _SINK_
312-
313309
<java.io.Writer: void write(char[])> -> _SINK_
314310
<java.io.Writer: void write(char[],int,int)> -> _SINK_
315311
<java.io.Writer: void write(int)> -> _SINK_

soot-infoflow-android/src/soot/jimple/infoflow/android/source/AccessPathBasedSourceSinkManager.java

Lines changed: 389 additions & 323 deletions
Large diffs are not rendered by default.

soot-infoflow-android/src/soot/jimple/infoflow/android/source/AndroidSourceSinkManager.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,12 @@ protected boolean isEntryPointMethod(SootMethod method) {
426426
}
427427

428428
@Override
429-
protected ISourceSinkDefinition getSinkDefinition(Stmt sCallSite, InfoflowManager manager, AccessPath ap) {
430-
ISourceSinkDefinition definition = super.getSinkDefinition(sCallSite, manager, ap);
431-
if (definition != null)
432-
return definition;
429+
protected Collection<ISourceSinkDefinition> getSinkDefinitions(Stmt sCallSite, InfoflowManager manager, AccessPath ap) {
430+
Collection<ISourceSinkDefinition> definitions = super.getSinkDefinitions(sCallSite, manager, ap);
431+
if (definitions.size() > 0)
432+
return definitions;
433433

434+
HashSet<ISourceSinkDefinition> sinkDefs = new HashSet<>();
434435
if (sCallSite.containsInvokeExpr()) {
435436
final SootMethod callee = sCallSite.getInvokeExpr().getMethod();
436437
final String subSig = callee.getSubSignature();
@@ -455,24 +456,24 @@ protected ISourceSinkDefinition getSinkDefinition(Stmt sCallSite, InfoflowManage
455456
if (Scene.v().getOrMakeFastHierarchy().isSubclass(sc, clazz)) {
456457
SootMethod sm = clazz.getMethodUnsafe(subSig);
457458
if (sm != null) {
458-
ISourceSinkDefinition def = this.sinkMethods.get(sm);
459-
if (def != null)
460-
return def;
459+
Collection<ISourceSinkDefinition> defs = this.sinkMethods.get(sm);
460+
sinkDefs.addAll(defs);
461461
break;
462462
}
463463
}
464464
}
465465
}
466466
}
467-
return null;
467+
return sinkDefs;
468468
}
469469

470470
@Override
471-
protected ISourceSinkDefinition getInverseSink(Stmt sCallSite, IInfoflowCFG cfg) {
472-
ISourceSinkDefinition definition = super.getInverseSink(sCallSite, cfg);
473-
if (definition != null)
471+
protected Collection<ISourceSinkDefinition> getInverseSinkDefinition(Stmt sCallSite, IInfoflowCFG cfg) {
472+
Collection<ISourceSinkDefinition> definition = super.getInverseSinkDefinition(sCallSite, cfg);
473+
if (definition.size() > 0)
474474
return definition;
475475

476+
HashSet<ISourceSinkDefinition> sinkDefs = new HashSet<>();
476477
if (sCallSite.containsInvokeExpr()) {
477478
final SootMethod callee = sCallSite.getInvokeExpr().getMethod();
478479
final String subSig = callee.getSubSignature();
@@ -482,15 +483,15 @@ protected ISourceSinkDefinition getInverseSink(Stmt sCallSite, IInfoflowCFG cfg)
482483
if (Scene.v().getOrMakeFastHierarchy().isSubclass(sc, clazz)) {
483484
SootMethod sm = clazz.getMethodUnsafe(subSig);
484485
if (sm != null) {
485-
ISourceSinkDefinition def = this.sinkMethods.get(sm);
486-
if (def != null)
487-
return def;
486+
Collection<ISourceSinkDefinition> adefs = this.sinkMethods.get(sm);
487+
sinkDefs.addAll(adefs);
488488
break;
489489
}
490490
}
491491
}
492492
}
493-
return null;
493+
494+
return sinkDefs;
494495
}
495496

496497
@Override

soot-infoflow-android/src/soot/jimple/infoflow/android/source/parsers/xml/AbstractXMLSourceSinkParser.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import soot.jimple.infoflow.sourcesSinks.definitions.MethodSourceSinkDefinition.CallType;
3636
import soot.jimple.infoflow.sourcesSinks.definitions.SourceSinkCondition;
3737
import soot.jimple.infoflow.sourcesSinks.definitions.SourceSinkType;
38+
import soot.util.MultiMap;
3839

3940
/**
4041
* Abstract class for all Flowdroid XML parsers. Returns a Set of Methods when
@@ -265,7 +266,7 @@ protected void handleStarttagParam(Attributes attributes, String qNameLower) {
265266
}
266267

267268
protected void handleStarttagPathelement(Attributes attributes) {
268-
if (methodSignature != null && attributes != null) {
269+
if (attributes != null) {
269270
String tempStr = attributes.getValue(XMLConstants.FIELD_ATTRIBUTE);
270271
if (tempStr != null && !tempStr.isEmpty()) {
271272
pathElements.add(tempStr);
@@ -519,7 +520,7 @@ protected void handleEndtagAccesspath() {
519520

520521
}
521522

522-
protected Map<String, ISourceSinkDefinition> sourcesAndSinks;
523+
protected MultiMap<String, ISourceSinkDefinition> sourcesAndSinks;
523524

524525
protected Set<ISourceSinkDefinition> sources = new HashSet<>();
525526
protected Set<ISourceSinkDefinition> sinks = new HashSet<>();
@@ -592,10 +593,7 @@ protected void parseInputStream(InputStream stream) {
592593
* @param ssd The source or sink definition
593594
*/
594595
protected void addSourceSinkDefinition(String signature, IAccessPathBasedSourceSinkDefinition ssd) {
595-
if (sourcesAndSinks.containsKey(signature))
596-
sourcesAndSinks.get(signature).merge(ssd);
597-
else
598-
sourcesAndSinks.put(signature, ssd);
596+
sourcesAndSinks.put(signature, ssd);
599597
}
600598

601599
public Set<ISourceSinkDefinition> getSources() {
@@ -622,10 +620,7 @@ public Set<ISourceSinkDefinition> getAllMethods() {
622620
}
623621

624622
protected void addSourceSinkDefinition(String signature, ISourceSinkDefinition ssd) {
625-
if (sourcesAndSinks.containsKey(signature))
626-
sourcesAndSinks.get(signature).merge(ssd);
627-
else
628-
sourcesAndSinks.put(signature, ssd);
623+
sourcesAndSinks.put(signature, ssd);
629624
}
630625

631626
/**

soot-infoflow-android/src/soot/jimple/infoflow/android/source/parsers/xml/XMLSourceSinkParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import soot.jimple.infoflow.sourcesSinks.definitions.MethodSourceSinkDefinition.CallType;
3131
import soot.jimple.infoflow.sourcesSinks.definitions.SourceSinkCondition;
3232
import soot.jimple.infoflow.sourcesSinks.definitions.SourceSinkType;
33+
import soot.util.HashMultiMap;
3334

3435
/**
3536
* Parses informations from the new Dataformat (XML) with the help of SAX.
@@ -94,7 +95,7 @@ public static XMLSourceSinkParser fromStream(InputStream inputStream, ICategoryF
9495
* @param filter A filter for excluding certain categories of sources and sinks
9596
*/
9697
protected XMLSourceSinkParser(ICategoryFilter categoryFilter) {
97-
this.sourcesAndSinks = new HashMap<>();
98+
this.sourcesAndSinks = new HashMultiMap<>();
9899
this.categoryFilter = categoryFilter;
99100
}
100101

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

Lines changed: 0 additions & 18 deletions
This file was deleted.

soot-infoflow-android/test/soot/jimple/infoflow/android/test/droidBench/backward/FieldSourceTest.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

soot-infoflow-android/test/soot/jimple/infoflow/android/test/droidBench/forward/FieldSourceTest.java

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target/
2-
/build/
2+
/build/
3+
/sootOutput/

soot-infoflow-integration/pom.xml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
<build>
2121
<finalName>soot-infoflow-integration-classes</finalName>
22-
<sourceDirectory>src</sourceDirectory>
2322
<testSourceDirectory>test</testSourceDirectory>
2423
<outputDirectory>build/classes</outputDirectory>
2524
<testOutputDirectory>build/testclasses</testOutputDirectory>
@@ -38,14 +37,6 @@
3837
<groupId>org.apache.maven.plugins</groupId>
3938
<artifactId>maven-jar-plugin</artifactId>
4039
<version>${maven-jar-plugin.version}</version>
41-
<configuration>
42-
<archive>
43-
<manifest>
44-
<addClasspath>true</addClasspath>
45-
<mainClass>soot.jimple.infoflow.methodSummary.Main</mainClass>
46-
</manifest>
47-
</archive>
48-
</configuration>
4940
</plugin>
5041
<plugin>
5142
<groupId>org.apache.maven.plugins</groupId>
@@ -91,6 +82,11 @@
9182
<targetPath>schema</targetPath>
9283
</resource>
9384
</resources>
85+
<testResources>
86+
<testResource>
87+
<directory>soot-infoflow-summaries/res</directory>
88+
</testResource>
89+
</testResources>
9490
</build>
9591

9692
<dependencies>

0 commit comments

Comments
 (0)