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

Skip to content

Commit 1a5eede

Browse files
committed
JS: SetConstructor
1 parent 5c9a239 commit 1a5eede

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,17 @@ private module CollectionDataFlow {
137137
/**
138138
* A step for the `Set` constructor, which copies any elements from the first argument into the resulting set.
139139
*/
140-
private class SetConstructor extends CollectionFlowStep, DataFlow::NewNode {
141-
SetConstructor() { this = DataFlow::globalVarRef("Set").getAnInstantiation() }
142-
143-
override predicate loadStore(
144-
DataFlow::Node pred, DataFlow::Node succ, PseudoProperty fromProp, PseudoProperty toProp
140+
private class SetConstructor extends PreCallGraphStep {
141+
override predicate loadStoreStep(
142+
DataFlow::Node pred, DataFlow::SourceNode succ, string fromProp, string toProp
145143
) {
146-
pred = this.getArgument(0) and
147-
succ = this and
148-
fromProp = arrayLikeElement() and
149-
toProp = setElement()
144+
exists(DataFlow::NewNode invoke |
145+
invoke = DataFlow::globalVarRef("Set").getAnInstantiation() and
146+
pred = invoke.getArgument(0) and
147+
succ = invoke and
148+
fromProp = arrayLikeElement() and
149+
toProp = setElement()
150+
)
150151
}
151152
}
152153

0 commit comments

Comments
 (0)