Skip to content

Commit 4f3876f

Browse files
RasmusWLyoff
andcommitted
Python: Accept rewrite for _join( predicates
Co-authored-by: yoff <[email protected]>
1 parent 7c242b1 commit 4f3876f

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowDispatch.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -854,14 +854,9 @@ private module MethodCalls {
854854
private predicate directCall_join(
855855
CallNode call, string functionName, Class cls, AttrRead attr, Node self
856856
) {
857-
(
858-
call.getFunction() = attrReadTracker(attr).asCfgNode() and
859-
attr.accesses(classTracker(cls), functionName)
860-
or
861-
call.getFunction() = attrReadTracker(attr).asCfgNode() and
862-
attr.accesses(classInstanceTracker(cls), functionName)
863-
) and
864-
attr.accesses(self, functionName)
857+
call.getFunction() = attrReadTracker(attr).asCfgNode() and
858+
attr.accesses(self, functionName) and
859+
self in [classTracker(cls), classInstanceTracker(cls)]
865860
}
866861

867862
/**
@@ -886,14 +881,9 @@ private module MethodCalls {
886881
private predicate callWithinMethodImplicitSelfOrCls_join(
887882
CallNode call, string functionName, Class classWithMethod, AttrRead attr, Node self
888883
) {
889-
(
890-
call.getFunction() = attrReadTracker(attr).asCfgNode() and
891-
attr.accesses(clsTracker(classWithMethod), functionName)
892-
or
893-
call.getFunction() = attrReadTracker(attr).asCfgNode() and
894-
attr.accesses(selfTracker(classWithMethod), functionName)
895-
) and
896-
attr.accesses(self, functionName)
884+
call.getFunction() = attrReadTracker(attr).asCfgNode() and
885+
attr.accesses(self, functionName) and
886+
self in [clsTracker(classWithMethod), selfTracker(classWithMethod)]
897887
}
898888

899889
/**

0 commit comments

Comments
 (0)