Skip to content

Commit e7b495e

Browse files
committed
Java: model Collections::addAll
1 parent 5cf5c77 commit e7b495e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

java/ql/src/semmle/code/java/dataflow/internal/ContainerFlow.qll

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,17 @@ private predicate argToMethodStep(Expr tracked, MethodAccess sink) {
218218
*/
219219
private predicate argToArgStep(Expr tracked, Expr sink) {
220220
exists(MethodAccess ma, Method method, int input, int output |
221-
taintPreservingArgToArg(method, input, output) and
222221
ma.getMethod() = method and
223222
ma.getArgument(input) = tracked and
224-
ma.getArgument(output) = sink
223+
ma.getArgument(output) = sink and
224+
(
225+
taintPreservingArgToArg(method, input, output)
226+
or
227+
method.getDeclaringType().hasQualifiedName("java.util", "Collections") and
228+
method.hasName("addAll") and
229+
input >= 1 and
230+
output = 0
231+
)
225232
)
226233
}
227234

0 commit comments

Comments
 (0)