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

Skip to content

Commit 530be38

Browse files
committed
JS: MapGet
1 parent 4a45731 commit 530be38

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

javascript/ql/src/semmle/javascript/Collections.qll

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,15 @@ private module CollectionDataFlow {
196196
* A call to the `get` method on a Map.
197197
* If the key of the call to `get` has a known string value, then only the value corresponding to that key will be retrieved. (The known string value is encoded as part of the pseudo-property)
198198
*/
199-
private class MapGet extends CollectionFlowStep, DataFlow::MethodCallNode {
200-
MapGet() { this.getMethodName() = "get" }
201-
202-
override predicate load(DataFlow::Node obj, DataFlow::Node element, PseudoProperty prop) {
203-
obj = this.getReceiver() and
204-
element = this and
205-
// reading the join of known and unknown values
206-
(prop = mapValue(this.getArgument(0)) or prop = mapValueUnknownKey())
199+
private class MapGet extends PreCallGraphStep {
200+
override predicate loadStep(DataFlow::Node obj, DataFlow::Node element, string prop) {
201+
exists(DataFlow::MethodCallNode call |
202+
call.getMethodName() = "get" and
203+
obj = call.getReceiver() and
204+
element = call and
205+
// reading the join of known and unknown values
206+
(prop = mapValue(call.getArgument(0)) or prop = mapValueUnknownKey())
207+
)
207208
}
208209
}
209210

0 commit comments

Comments
 (0)