Skip to content

Commit 81af9a1

Browse files
committed
Fix missing flow through super calls
1 parent 12370e9 commit 81af9a1

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

javascript/ql/lib/semmle/javascript/dataflow/internal/DataFlowPrivate.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,9 @@ private predicate isArgumentNodeImpl(Node n, DataFlowCall call, ArgumentPosition
470470
or
471471
pos.isThis() and n = TNewCallThisArgument(call.asOrdinaryCall().asExpr())
472472
or
473+
pos.isThis() and
474+
n = TImplicitThisUse(call.asOrdinaryCall().asExpr().(SuperCall).getCallee(), false)
475+
or
473476
// receiver of accessor call
474477
pos.isThis() and n = call.asAccessorCall().getBase()
475478
or

javascript/ql/test/library-tests/TripleDot/useuse.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,20 @@ function t6() {
9494
sink(c.y); // $ hasValueFlow=t6.2
9595
c.methodLike();
9696
}
97+
98+
function t7() {
99+
class Base {
100+
constructor(x) {
101+
this.field = x;
102+
sink(this.field); // $ hasTaintFlow=t7.1
103+
}
104+
}
105+
class Sub extends Base {
106+
constructor(x) {
107+
super(x + '!');
108+
sink(this.field); // $ hasTaintFlow=t7.1
109+
}
110+
}
111+
const c = new Sub(source('t7.1'));
112+
sink(c.field); // $ hasTaintFlow=t7.1
113+
}

0 commit comments

Comments
 (0)