Skip to content

Commit 093c690

Browse files
committed
Swift: only read ArrayContent from subscript keypaths
1 parent bcc4565 commit 093c690

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,8 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
764764
(
765765
c.isSingleton(any(Content::FieldContent ct | ct.getField() = component.getDeclRef()))
766766
or
767-
c.isSingleton(any(Content::ArrayContent ac))
767+
c.isSingleton(any(Content::ArrayContent ac)) and
768+
component.isSubscript()
768769
)
769770
|
770771
// the next node is either the next element in the chain

0 commit comments

Comments
 (0)