mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: IteratorExceptionStep
This commit is contained in:
@@ -74,23 +74,13 @@ private class ArrayIterationCallbackAsPartialInvoke extends DataFlow::PartialInv
|
||||
* A flow step propagating the exception thrown from a callback to a method whose name coincides
|
||||
* a built-in Array iteration method, such as `forEach` or `map`.
|
||||
*/
|
||||
private class IteratorExceptionStep extends DataFlow::MethodCallNode, DataFlow::AdditionalFlowStep {
|
||||
IteratorExceptionStep() {
|
||||
exists(string name | name = getMethodName() |
|
||||
name = "forEach" or
|
||||
name = "each" or
|
||||
name = "map" or
|
||||
name = "filter" or
|
||||
name = "some" or
|
||||
name = "every" or
|
||||
name = "fold" or
|
||||
name = "reduce"
|
||||
)
|
||||
}
|
||||
|
||||
private class IteratorExceptionStep extends DataFlow::SharedFlowStep {
|
||||
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
pred = getAnArgument().(DataFlow::FunctionNode).getExceptionalReturn() and
|
||||
succ = this.getExceptionalReturn()
|
||||
exists(DataFlow::MethodCallNode call |
|
||||
call.getMethodName() = ["forEach", "each", "map", "filter", "some", "every", "fold", "reduce"] and
|
||||
pred = call.getAnArgument().(DataFlow::FunctionNode).getExceptionalReturn() and
|
||||
succ = call.getExceptionalReturn()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user