Fix modelling of Stack.push

Stack.push(E) returns its argument, it does not propagate taint from
the stack to the return value.
This commit is contained in:
Arthur Baars
2020-07-09 15:00:59 +02:00
parent d3d58795f1
commit 0d33a77ee3
3 changed files with 7 additions and 4 deletions

View File

@@ -127,7 +127,7 @@ private predicate taintPreservingQualifierToMethod(Method m) {
m.(CollectionMethod).hasName(["elementAt", "elements", "firstElement", "lastElement"])
or
// java.util.Stack
m.(CollectionMethod).hasName(["peek", "pop", "push"])
m.(CollectionMethod).hasName(["peek", "pop"])
or
// java.util.Queue
m.(CollectionMethod).hasName(["element", "poll"])
@@ -269,6 +269,9 @@ private predicate taintPreservingArgumentToQualifier(Method method, int arg) {
* `arg`th argument is tainted.
*/
private predicate taintPreservingArgumentToMethod(Method method, int arg) {
// java.util.Stack
method.(CollectionMethod).hasName("push") and arg = 0
or
method.getDeclaringType().hasQualifiedName("java.util", "Collections") and
(
method