Skip to content

Commit 41ad1ed

Browse files
committed
Swift: fix cartesian product in array readStep
1 parent ec99977 commit 41ad1ed

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
@@ -705,7 +705,8 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
705705
node1.asExpr() = assign.getSource() and
706706
node2.(PostUpdateNode).getPreUpdateNode().asExpr() = subscript.getBase() and
707707
subscript = assign.getDest() and
708-
subscript.getBase().getType().(InOutType).getObjectType() instanceof ArrayType
708+
subscript.getBase().getType().(InOutType).getObjectType() instanceof ArrayType and
709+
c.isSingleton(any(Content::ArrayContent ac))
709710
)
710711
or
711712
FlowSummaryImpl::Private::Steps::summaryStoreStep(node1.(FlowSummaryNode).getSummaryNode(), c,

0 commit comments

Comments
 (0)