Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0035def

Browse files
committed
JS: ExceptionStep
1 parent 5051f10 commit 0035def

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

javascript/ql/src/semmle/javascript/frameworks/LodashUnderscore.qll

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ module LodashUnderscore {
360360
/**
361361
* A data flow step propagating an exception thrown from a callback to a Lodash/Underscore function.
362362
*/
363-
private class ExceptionStep extends DataFlow::CallNode, DataFlow::AdditionalFlowStep {
364-
ExceptionStep() {
365-
exists(string name | this = member(name).getACall() |
363+
private class ExceptionStep extends DataFlow::SharedFlowStep {
364+
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
365+
exists(DataFlow::CallNode call, string name |
366366
// Members ending with By, With, or While indicate that they are a variant of
367367
// another function that takes a callback.
368368
name.matches("%By") or
@@ -386,13 +386,12 @@ module LodashUnderscore {
386386
name = "replace" or
387387
name = "some" or
388388
name = "transform"
389+
|
390+
call = member(name).getACall() and
391+
pred = call.getAnArgument().(DataFlow::FunctionNode).getExceptionalReturn() and
392+
succ = call.getExceptionalReturn()
389393
)
390394
}
391-
392-
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
393-
pred = getAnArgument().(DataFlow::FunctionNode).getExceptionalReturn() and
394-
succ = this.getExceptionalReturn()
395-
}
396395
}
397396

398397
/**

0 commit comments

Comments
 (0)