mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
JS: autoformat
This commit is contained in:
@@ -663,18 +663,21 @@ private predicate flowThroughProperty(
|
||||
private predicate summarizedHigherOrderCall(
|
||||
DataFlow::Node arg, DataFlow::Node cb, int i, DataFlow::Configuration cfg, PathSummary summary
|
||||
) {
|
||||
exists (Function f, DataFlow::InvokeNode outer, DataFlow::InvokeNode inner, int j,
|
||||
DataFlow::Node innerArg, DataFlow::ParameterNode cbParm, PathSummary oldSummary |
|
||||
exists(
|
||||
Function f, DataFlow::InvokeNode outer, DataFlow::InvokeNode inner, int j,
|
||||
DataFlow::Node innerArg, DataFlow::ParameterNode cbParm, PathSummary oldSummary
|
||||
|
|
||||
reachableFromInput(f, outer, arg, innerArg, cfg, oldSummary) and
|
||||
argumentPassing(outer, cb, f, cbParm) and
|
||||
innerArg = inner.getArgument(j) |
|
||||
innerArg = inner.getArgument(j)
|
||||
|
|
||||
// direct higher-order call
|
||||
cbParm.flowsTo(inner.getCalleeNode()) and
|
||||
i = j and
|
||||
summary = oldSummary
|
||||
or
|
||||
// indirect higher-order call
|
||||
exists (DataFlow::Node cbArg, PathSummary newSummary |
|
||||
exists(DataFlow::Node cbArg, PathSummary newSummary |
|
||||
cbParm.flowsTo(cbArg) and
|
||||
summarizedHigherOrderCall(innerArg, cbArg, i, cfg, newSummary) and
|
||||
summary = oldSummary.append(PathSummary::call()).append(newSummary)
|
||||
@@ -696,14 +699,14 @@ predicate higherOrderCall(
|
||||
PathSummary summary
|
||||
) {
|
||||
// Summarized call
|
||||
exists (DataFlow::Node cb |
|
||||
exists(DataFlow::Node cb |
|
||||
summarizedHigherOrderCall(arg, cb, i, cfg, summary) and
|
||||
callback.flowsTo(cb)
|
||||
)
|
||||
or
|
||||
// Local invocation of a parameter
|
||||
isRelevant(arg, cfg) and
|
||||
exists (DataFlow::InvokeNode invoke |
|
||||
exists(DataFlow::InvokeNode invoke |
|
||||
arg = invoke.getArgument(i) and
|
||||
invoke = callback.(DataFlow::ParameterNode).getACall() and
|
||||
summary = PathSummary::call()
|
||||
@@ -721,7 +724,6 @@ predicate higherOrderCall(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Holds if `pred` is passed as an argument to a function `f` which also takes a
|
||||
* callback parameter `cb` and then invokes `cb`, passing `pred` into parameter `succ`
|
||||
|
||||
@@ -109,9 +109,7 @@ predicate argumentPassing(
|
||||
* Holds if there is a flow step from `pred` to `succ` through parameter passing
|
||||
* to a function call.
|
||||
*/
|
||||
predicate callStep(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
argumentPassing(_, pred, _, succ)
|
||||
}
|
||||
predicate callStep(DataFlow::Node pred, DataFlow::Node succ) { argumentPassing(_, pred, _, succ) }
|
||||
|
||||
/**
|
||||
* Holds if there is a flow step from `pred` to `succ` through returning
|
||||
@@ -258,14 +256,14 @@ predicate loadStep(DataFlow::Node pred, DataFlow::PropRead succ, string prop) {
|
||||
* invocation.
|
||||
*/
|
||||
predicate callback(DataFlow::Node arg, DataFlow::SourceNode cb) {
|
||||
exists (DataFlow::InvokeNode invk, DataFlow::ParameterNode cbParm, DataFlow::Node cbArg |
|
||||
exists(DataFlow::InvokeNode invk, DataFlow::ParameterNode cbParm, DataFlow::Node cbArg |
|
||||
arg = invk.getAnArgument() and
|
||||
cbParm.flowsTo(invk.getCalleeNode()) and
|
||||
callStep(cbArg, cbParm) and
|
||||
cb.flowsTo(cbArg)
|
||||
)
|
||||
or
|
||||
exists (DataFlow::ParameterNode cbParm, DataFlow::Node cbArg |
|
||||
exists(DataFlow::ParameterNode cbParm, DataFlow::Node cbArg |
|
||||
callback(arg, cbParm) and
|
||||
callStep(cbArg, cbParm) and
|
||||
cb.flowsTo(cbArg)
|
||||
|
||||
Reference in New Issue
Block a user