Skip to content

Commit f5d014b

Browse files
committed
JS: Remove allocation site restriction in CG
1 parent ca1a27d commit f5d014b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

javascript/ql/lib/semmle/javascript/dataflow/internal/CallGraphs.qll

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,8 @@ module CallGraph {
241241
)
242242
}
243243

244-
private DataFlow::FunctionNode getAMethodOnPlainObject(DataFlow::SourceNode node) {
244+
private DataFlow::FunctionNode getAMethodOnObject(DataFlow::SourceNode node) {
245245
(
246-
(
247-
node instanceof DataFlow::ObjectLiteralNode
248-
or
249-
node instanceof DataFlow::FunctionNode
250-
) and
251246
result = node.getAPropertySource()
252247
or
253248
result = node.(DataFlow::ObjectLiteralNode).getPropertyGetter(_)
@@ -258,7 +253,7 @@ module CallGraph {
258253
}
259254

260255
private predicate shouldTrackObjectWithMethods(DataFlow::SourceNode node) {
261-
exists(getAMethodOnPlainObject(node))
256+
exists(getAMethodOnObject(node))
262257
}
263258

264259
/**
@@ -292,7 +287,7 @@ module CallGraph {
292287
predicate impliedReceiverStep(DataFlow::SourceNode pred, DataFlow::SourceNode succ) {
293288
exists(DataFlow::SourceNode host |
294289
pred = getAnAllocationSiteRef(host) and
295-
succ = getAMethodOnPlainObject(host).getReceiver()
290+
succ = getAMethodOnObject(host).getReceiver()
296291
)
297292
}
298293
}

0 commit comments

Comments
 (0)