Skip to content

Commit 5fb28dc

Browse files
committed
Merge branch 'develop' of github.com:secure-software-engineering/FlowDroid into develop
2 parents 15ac8a7 + 633292c commit 5fb28dc

File tree

7 files changed

+328
-15
lines changed

7 files changed

+328
-15
lines changed

soot-infoflow-summaries/src/soot/jimple/infoflow/methodSummary/taintWrappers/resolvers/SummaryResolver.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ public SummaryResponse load(SummaryQuery query) throws Exception {
5353
if (declaredClass != null && !isClassSupported)
5454
isClassSupported = getSummariesHierarchy(methodSig, classSummaries, declaredClass);
5555

56-
if (!classSummaries.isEmpty())
56+
if (isClassSupported) {
57+
if (classSummaries.isEmpty())
58+
return SummaryResponse.EMPTY_BUT_SUPPORTED;
5759
return new SummaryResponse(classSummaries, isClassSupported);
58-
else
59-
return isClassSupported ? SummaryResponse.EMPTY_BUT_SUPPORTED : SummaryResponse.NOT_SUPPORTED;
60+
} else
61+
return SummaryResponse.NOT_SUPPORTED;
6062
}
6163

6264
/**
@@ -135,24 +137,25 @@ private boolean getSummariesHierarchy(final String methodSig, final ClassSummari
135137
// flows for all possible classes.
136138
SootMethod targetMethod = clazz.getMethodUnsafe(methodSig);
137139
if (!clazz.isConcrete() || targetMethod == null || !targetMethod.isConcrete()) {
140+
int found = 0;
138141
Set<SootClass> childClasses = getAllChildClasses(clazz);
139-
if (childClasses.size() > MAX_HIERARCHY_DEPTH)
140-
return false;
141-
142-
boolean found = false;
143142
for (SootClass childClass : childClasses) {
144143
// Do we have support for the target class?
145144
if (summaries.merge(flows.getMethodFlows(childClass, methodSig)))
146-
found = true;
145+
found++;
147146

148147
// Do we support any interface this class might have?
149148
if (checkInterfaces(methodSig, summaries, childClass))
150-
found = true;
149+
found++;
150+
151+
// If we have too many summaries that could be applicable, we abort here to
152+
// avoid false positives
153+
if (found > MAX_HIERARCHY_DEPTH)
154+
return false;
151155
}
152-
return found;
156+
return found > 0;
153157
}
154158
return false;
155-
156159
}
157160

158161
/**

soot-infoflow-summaries/summariesManual/java.util.Stack.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<?xml version="1.0" ?>
22
<summary fileFormatVersion="101">
3-
<hierarchy>
3+
<hierarchy superClass="java.util.Vector">
44
<interface name="java.util.List" />
5+
<interface name="java.util.Collection" />
6+
<interface name="java.util.RandomAccess" />
7+
<interface name="java.lang.Iterable" />
8+
<interface name="java.lang.Cloneable" />
9+
<interface name="java.io.Serializable" />
510
</hierarchy>
611
<methods>
712
<method id="void addElement(java.lang.Object)">

soot-infoflow-summaries/summariesManual/java.util.Vector.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?xml version="1.0" ?>
22
<summary fileFormatVersion="101">
3+
<hierarchy superClass="java.util.AbstractList">
4+
<interface name="java.util.List" />
5+
<interface name="java.util.Collection" />
6+
<interface name="java.util.RandomAccess" />
7+
<interface name="java.lang.Iterable" />
8+
<interface name="java.lang.Cloneable" />
9+
<interface name="java.io.Serializable" />
10+
</hierarchy>
311
<methods>
412
<method id="void &lt;init&gt;(java.util.Collection)">
513
<flows>
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
<?xml version="1.0" ?><summary fileFormatVersion="101"><methods><method id="void remove()"><flows><flow isAlias="false"><from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int lastRet&gt;]" AccessPathTypes="[int]"></from><to sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int cursor&gt;]" AccessPathTypes="[int]" taintSubFields="true"></to></flow><flow isAlias="false"><from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: java.util.ArrayList this$0&gt;, &lt;java.util.AbstractList: int modCount&gt;]" AccessPathTypes="[java.util.ArrayList, int]"></from><to sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int expectedModCount&gt;]" AccessPathTypes="[int]" taintSubFields="true"></to></flow></flows></method><method id="java.lang.Object next()"><flows><flow isAlias="true"><from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: java.util.ArrayList this$0&gt;, &lt;java.util.ArrayList: java.lang.Object[] elementData&gt;]" AccessPathTypes="[java.util.ArrayList, java.lang.Object[]]"></from><to sourceSinkType="Return" BaseType="java.lang.Object" taintSubFields="true"></to></flow><flow isAlias="false"><from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int cursor&gt;]" AccessPathTypes="[int]"></from><to sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int lastRet&gt;]" AccessPathTypes="[int]" taintSubFields="true"></to></flow></flows></method></methods><gaps></gaps></summary>
1+
<?xml version="1.0"?>
2+
<summary fileFormatVersion="101">
3+
<hierarchy superClass="java.lang.Object">
4+
<interface name="java.util.Iterator" />
5+
</hierarchy>
6+
<methods>
7+
<method id="void remove()">
8+
<flows>
9+
<flow isAlias="false">
10+
<from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int lastRet&gt;]" AccessPathTypes="[int]"></from>
11+
<to sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int cursor&gt;]" AccessPathTypes="[int]" taintSubFields="true"></to>
12+
</flow>
13+
<flow isAlias="false">
14+
<from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: java.util.ArrayList this$0&gt;, &lt;java.util.AbstractList: int modCount&gt;]" AccessPathTypes="[java.util.ArrayList, int]"></from>
15+
<to sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int expectedModCount&gt;]" AccessPathTypes="[int]" taintSubFields="true"></to>
16+
</flow>
17+
</flows>
18+
</method>
19+
<method id="java.lang.Object next()">
20+
<flows>
21+
<flow isAlias="true">
22+
<from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: java.util.ArrayList this$0&gt;, &lt;java.util.ArrayList: java.lang.Object[] elementData&gt;]" AccessPathTypes="[java.util.ArrayList, java.lang.Object[]]"></from>
23+
<to sourceSinkType="Return" BaseType="java.lang.Object" taintSubFields="true"></to>
24+
</flow>
25+
<flow isAlias="false">
26+
<from sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int cursor&gt;]" AccessPathTypes="[int]"></from>
27+
<to sourceSinkType="Field" BaseType="java.util.ArrayList$Itr" AccessPath="[&lt;java.util.ArrayList$Itr: int lastRet&gt;]" AccessPathTypes="[int]" taintSubFields="true"></to>
28+
</flow>
29+
</flows>
30+
</method>
31+
</methods>
32+
<gaps></gaps>
33+
</summary>

0 commit comments

Comments
 (0)