Skip to content

Commit 6c8dfb2

Browse files
tausbnyoff
andauthored
Python: Use flowsTo instead of hasLocalSource
Co-authored-by: yoff <lerchedahl@gmail.com>
1 parent a667431 commit 6c8dfb2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class LocalSourceNode extends Node {
451451
}
452452

453453
/** Holds if this `LocalSourceNode` can flow to `nodeTo` in one or more local flow steps. */
454-
cached
454+
pragma[inline]
455455
predicate flowsTo(Node nodeTo) { Cached::hasLocalSource(nodeTo, this) }
456456

457457
/**
@@ -509,7 +509,7 @@ private module Cached {
509509
*/
510510
cached
511511
predicate namedAttrRef(LocalSourceNode base, string attr, AttrRef ref) {
512-
hasLocalSource(ref.getObject(), base) and
512+
base.flowsTo(ref.getObject()) and
513513
ref.getAttributeName() = attr
514514
}
515515

@@ -518,7 +518,7 @@ private module Cached {
518518
*/
519519
cached
520520
predicate dynamicAttrRef(LocalSourceNode base, AttrRef ref) {
521-
hasLocalSource(ref.getObject(), base) and
521+
base.flowsTo(ref.getObject()) and
522522
not exists(ref.getAttributeName())
523523
}
524524

@@ -530,7 +530,7 @@ private module Cached {
530530
exists(CfgNode n, CallNode call_node |
531531
call.asCfgNode() = call_node and n.asCfgNode() = call_node.getFunction()
532532
|
533-
hasLocalSource(n, func)
533+
func.flowsTo(n)
534534
)
535535
}
536536
}

0 commit comments

Comments
 (0)