@@ -89,45 +89,89 @@ class ContainerType extends RefType {
89
89
}
90
90
91
91
private predicate taintPreservingQualifierToMethod ( Method m ) {
92
+ // java.util.Map.Entry
92
93
m .getDeclaringType ( ) instanceof EntryType and
93
- m .hasName ( "getValue" )
94
+ m .hasName ( [ "getValue" , "setValue" ] )
94
95
or
96
+ // java.util.Iterable
95
97
m .getDeclaringType ( ) instanceof IterableType and
96
- m .hasName ( "iterator" )
98
+ m .hasName ( [ "iterator" , "spliterator" ] )
97
99
or
100
+ // java.util.Iterator
98
101
m .getDeclaringType ( ) instanceof IteratorType and
99
102
m .hasName ( "next" )
100
103
or
104
+ // java.util.ListIterator
105
+ m .getDeclaringType ( ) instanceof IteratorType and
106
+ m .hasName ( "previous" )
107
+ or
108
+ // java.util.Enumeration
101
109
m .getDeclaringType ( ) instanceof EnumerationType and
102
- m .hasName ( "nextElement" )
110
+ m .hasName ( [ "asIterator" , "nextElement" ] )
111
+ or
112
+ // java.util.Map
113
+ m
114
+ .( MapMethod )
115
+ .hasName ( [ "compute" , "computeIfAbsent" , "computeIfPresent" , "entrySet" , "get" , "getOrDefault" ,
116
+ "merge" , "putIfAbsent" , "remove" , "replace" , "values" ] )
117
+ or
118
+ // java.util.Collection
119
+ m .( CollectionMethod ) .hasName ( [ "parallelStream" , "stream" , "toArray" ] )
103
120
or
104
- m .( MapMethod ) .hasName ( "entrySet" )
121
+ // java.util.List
122
+ m .( CollectionMethod ) .hasName ( [ "get" , "listIterator" , "set" , "subList" ] )
105
123
or
106
- m .( MapMethod ) .hasName ( "get" )
124
+ m .( CollectionMethod ) .hasName ( "remove" ) and
125
+ ( m .getNumberOfParameters ( ) = 0 or m .getParameterType ( 0 ) .( PrimitiveType ) .hasName ( "int" ) )
107
126
or
108
- m .( MapMethod ) .hasName ( "remove" )
127
+ // java.util.Vector
128
+ m .( CollectionMethod ) .hasName ( [ "elementAt" , "elements" , "firstElement" , "lastElement" ] )
109
129
or
110
- m .( MapMethod ) .hasName ( "values" )
130
+ // java.util.Stack
131
+ m .( CollectionMethod ) .hasName ( [ "peek" , "pop" , "push" ] )
111
132
or
112
- m .( CollectionMethod ) .hasName ( "toArray" )
133
+ // java.util.Queue
134
+ m .( CollectionMethod ) .hasName ( [ "element" , /*"peek", "remove"*/ "poll" ] )
113
135
or
114
- m .( CollectionMethod ) .hasName ( "get" )
136
+ // java.util.DeQueue
137
+ m
138
+ .( CollectionMethod )
139
+ .hasName ( [ "getFirst" , "getLast" , "peekFirst" , "peekLast" , "pollFirst" , "pollLast" ,
140
+ "removeFirst" , "removeLast" ] )
115
141
or
116
- m .( CollectionMethod ) .hasName ( "remove" ) and m .getParameterType ( 0 ) .( PrimitiveType ) .hasName ( "int" )
142
+ // java.util.concurrent.BlockingQueue
143
+ m .( CollectionMethod ) .hasName ( "take" )
117
144
or
118
- m .( CollectionMethod ) .hasName ( "remove" ) and m .getNumberOfParameters ( ) = 0
145
+ // java.util.concurrent.BlockingDeque
146
+ m .( CollectionMethod ) .hasName ( [ "takeFirst" , "takeLast" ] )
119
147
or
120
- m .( CollectionMethod ) .hasName ( "subList" )
148
+ // java.util.SortedSet
149
+ m .( CollectionMethod ) .hasName ( [ "first" , "headSet" , "last" , "subSet" , "tailSet" ] )
121
150
or
122
- m .( CollectionMethod ) .hasName ( "firstElement" )
151
+ // java.util.NavigableSet
152
+ m
153
+ .( CollectionMethod )
154
+ .hasName ( [ "ceiling" , "descendingIterator" , "descendingSet" , "floor" , "higher" , "lower" ] )
123
155
or
124
- m .( CollectionMethod ) .hasName ( "lastElement" )
156
+ //java.util.SortedMap
157
+ m .( MapMethod ) .hasName ( [ "headMap" , "subMap" , "tailMap" ] )
125
158
or
126
- m .( CollectionMethod ) .hasName ( "poll" )
159
+ //java.util.NavigableMap
160
+ m
161
+ .( MapMethod )
162
+ .hasName ( [ "ceilingEntry" , "descendingMap" , "firstEntry" , "floorEntry" , "higherEntry" ,
163
+ "lastEntry" , "lowerEntry" , "pollFirstEntry" , "pollLastEntry" ] )
127
164
or
128
- m .( CollectionMethod ) .hasName ( "peek" )
165
+ //java.util.Dictionary
166
+ m
167
+ .getDeclaringType ( )
168
+ .getSourceDeclaration ( )
169
+ .getASourceSupertype * ( )
170
+ .hasQualifiedName ( "java.util" , "Dictionary" ) and
171
+ m .hasName ( [ "elements" , "get" , "put" , "remove" ] )
129
172
or
130
- m .( CollectionMethod ) .hasName ( "element" )
173
+ // java.util.concurrent.ConcurrentHashMap
174
+ m .( MapMethod ) .hasName ( [ "search" , "searchEntries" , "searchValues" ] )
131
175
}
132
176
133
177
private predicate qualifierToMethodStep ( Expr tracked , MethodAccess sink ) {
0 commit comments