Skip to content

Commit f17bbd9

Browse files
committed
Python: Fix another bad TC.
This one is a bit awkward, since the previous version was supposed to improve indexing. Unfortunately this is vastly outweighed by the slow convergence of the TC. Right now we pay the cost of inverting the `hasFlowSource` relation, but this is still cheaper.
1 parent c2f112c commit f17bbd9

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -530,15 +530,12 @@ private module Cached {
530530
* The slightly backwards parametering ordering is to force correct indexing.
531531
*/
532532
cached
533-
predicate hasLocalSource(Node sink, Node source) {
534-
// Declaring `source` to be a `SourceNode` currently causes a redundant check in the
535-
// recursive case, so instead we check it explicitly here.
536-
source = sink and
537-
source instanceof LocalSourceNode
533+
predicate hasLocalSource(Node sink, LocalSourceNode source) {
534+
source = sink
538535
or
539-
exists(Node mid |
540-
hasLocalSource(mid, source) and
541-
simpleLocalFlowStep(mid, sink)
536+
exists(Node second |
537+
simpleLocalFlowStep(source, second) and
538+
simpleLocalFlowStep*(second, sink)
542539
)
543540
}
544541

0 commit comments

Comments
 (0)