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

Skip to content

Commit 5bfd2ad

Browse files
committed
JS: ArrayPopStep
1 parent 36a8134 commit 5bfd2ad

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,14 @@ private module ArrayDataFlow {
181181
* A step for retrieving an element from an array using `.pop()` or `.shift()`.
182182
* E.g. `array.pop()`.
183183
*/
184-
private class ArrayPopStep extends DataFlow::AdditionalFlowStep, DataFlow::MethodCallNode {
185-
ArrayPopStep() {
186-
getMethodName() = "pop" or
187-
getMethodName() = "shift"
188-
}
189-
184+
private class ArrayPopStep extends DataFlow::SharedFlowStep {
190185
override predicate loadStep(DataFlow::Node obj, DataFlow::Node element, string prop) {
191-
prop = arrayElement() and
192-
obj = this.getReceiver() and
193-
element = this
186+
exists(DataFlow::MethodCallNode call |
187+
call.getMethodName() = ["pop", "shift"] and
188+
prop = arrayElement() and
189+
obj = call.getReceiver() and
190+
element = call
191+
)
194192
}
195193
}
196194

0 commit comments

Comments
 (0)