Skip to content

Commit e586837

Browse files
committed
JS: Fix bad join order in exploratoryBoundInvokeStep
1 parent 9581bb5 commit e586837

File tree

1 file changed

+8
-4
lines changed
  • javascript/ql/src/semmle/javascript/dataflow/internal

1 file changed

+8
-4
lines changed

javascript/ql/src/semmle/javascript/dataflow/internal/FlowSteps.qll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ private module CachedSteps {
9292
cached
9393
predicate calls(DataFlow::InvokeNode invk, Function f) { f = invk.getACallee(0) }
9494

95+
private predicate callsBoundInternal(DataFlow::InvokeNode invk, Function f, int boundArgs, boolean contextDependent) {
96+
CallGraph::getABoundFunctionReference(f.flow(), boundArgs, contextDependent).flowsTo(invk.getCalleeNode())
97+
}
98+
9599
/**
96100
* Holds if `invk` may invoke a bound version of `f` with `boundArgs` already bound.
97101
*
@@ -101,7 +105,7 @@ private module CachedSteps {
101105
*/
102106
cached
103107
predicate callsBound(DataFlow::InvokeNode invk, Function f, int boundArgs) {
104-
CallGraph::getABoundFunctionReference(f.flow(), boundArgs, false).flowsTo(invk.getCalleeNode())
108+
callsBoundInternal(invk, f, boundArgs, false)
105109
}
106110

107111
/**
@@ -111,10 +115,10 @@ private module CachedSteps {
111115
*/
112116
cached
113117
predicate exploratoryBoundInvokeStep(DataFlow::Node pred, DataFlow::Node succ) {
114-
exists(DataFlow::InvokeNode invk, DataFlow::FunctionNode f, int i, int boundArgs |
115-
CallGraph::getABoundFunctionReference(f, boundArgs, _).flowsTo(invk.getCalleeNode()) and
118+
exists(DataFlow::InvokeNode invk, Function f, int i, int boundArgs |
119+
callsBoundInternal(invk, f, boundArgs, _) and
116120
pred = invk.getArgument(i) and
117-
succ = f.getParameter(i + boundArgs)
121+
succ = DataFlow::parameterNode(f.getParameter(i + boundArgs))
118122
)
119123
}
120124

0 commit comments

Comments
 (0)