Skip to content

Commit 5104fd8

Browse files
authored
Merge pull request #3051 from aschackmull/java/queue-taint-steps
Java: Add taint steps for java.util.Queue methods.
2 parents 0999970 + 99c55b6 commit 5104fd8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,19 @@ private predicate taintPreservingQualifierToMethod(Method m) {
115115
or
116116
m.(CollectionMethod).hasName("remove") and m.getParameterType(0).(PrimitiveType).hasName("int")
117117
or
118+
m.(CollectionMethod).hasName("remove") and m.getNumberOfParameters() = 0
119+
or
118120
m.(CollectionMethod).hasName("subList")
119121
or
120122
m.(CollectionMethod).hasName("firstElement")
121123
or
122124
m.(CollectionMethod).hasName("lastElement")
125+
or
126+
m.(CollectionMethod).hasName("poll")
127+
or
128+
m.(CollectionMethod).hasName("peek")
129+
or
130+
m.(CollectionMethod).hasName("element")
123131
}
124132

125133
private predicate qualifierToMethodStep(Expr tracked, MethodAccess sink) {
@@ -147,6 +155,8 @@ private predicate taintPreservingArgumentToQualifier(Method method, int arg) {
147155
method.(CollectionMethod).hasName("addElement") and arg = 0
148156
or
149157
method.(CollectionMethod).hasName("set") and arg = 1
158+
or
159+
method.(CollectionMethod).hasName("offer") and arg = 0
150160
}
151161

152162
private predicate argToQualifierStep(Expr tracked, Expr sink) {

0 commit comments

Comments
 (0)