Fix missing flow through super calls

This commit is contained in:
Asger F
2024-09-24 13:31:53 +02:00
parent 12370e9210
commit 81af9a1658
2 changed files with 20 additions and 0 deletions

View File

@@ -470,6 +470,9 @@ private predicate isArgumentNodeImpl(Node n, DataFlowCall call, ArgumentPosition
or
pos.isThis() and n = TNewCallThisArgument(call.asOrdinaryCall().asExpr())
or
pos.isThis() and
n = TImplicitThisUse(call.asOrdinaryCall().asExpr().(SuperCall).getCallee(), false)
or
// receiver of accessor call
pos.isThis() and n = call.asAccessorCall().getBase()
or

View File

@@ -94,3 +94,20 @@ function t6() {
sink(c.y); // $ hasValueFlow=t6.2
c.methodLike();
}
function t7() {
class Base {
constructor(x) {
this.field = x;
sink(this.field); // $ hasTaintFlow=t7.1
}
}
class Sub extends Base {
constructor(x) {
super(x + '!');
sink(this.field); // $ hasTaintFlow=t7.1
}
}
const c = new Sub(source('t7.1'));
sink(c.field); // $ hasTaintFlow=t7.1
}