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

Skip to content

Commit b7ae62c

Browse files
committed
JS: ArrayAppendStep
1 parent 1c815f1 commit b7ae62c

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

javascript/ql/src/semmle/javascript/Arrays.qll

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,14 @@ private module ArrayDataFlow {
125125
/**
126126
* A step for storing an element on an array using `arr.push(e)` or `arr.unshift(e)`.
127127
*/
128-
private class ArrayAppendStep extends DataFlow::AdditionalFlowStep, DataFlow::MethodCallNode {
129-
ArrayAppendStep() {
130-
this.getMethodName() = "push" or
131-
this.getMethodName() = "unshift"
132-
}
133-
128+
private class ArrayAppendStep extends DataFlow::SharedFlowStep {
134129
override predicate storeStep(DataFlow::Node element, DataFlow::SourceNode obj, string prop) {
135130
prop = arrayElement() and
136-
element = this.getAnArgument() and
137-
obj.getAMethodCall() = this
131+
exists(DataFlow::MethodCallNode call |
132+
call.getMethodName() = ["push", "unshift"] and
133+
element = call.getAnArgument() and
134+
obj.getAMethodCall() = call
135+
)
138136
}
139137
}
140138

0 commit comments

Comments
 (0)