Skip to content

Commit 0fd4f61

Browse files
committed
Swift: Allow subscript content reads from collections.
1 parent 1ac9d2c commit 0fd4f61

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,12 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
803803
exists(SubscriptExpr subscript |
804804
subscript.getBase() = node1.asExpr() and
805805
subscript = node2.asExpr() and
806-
subscript.getBase().getType() instanceof ArrayType and
807-
c.isSingleton(any(Content::ArrayContent ac))
806+
(
807+
subscript.getBase().getType() instanceof ArrayType and
808+
c.isSingleton(any(Content::ArrayContent ac))
809+
or
810+
c.isSingleton(any(Content::CollectionContent ac))
811+
)
808812
)
809813
or
810814
FlowSummaryImpl::Private::Steps::summaryReadStep(node1.(FlowSummaryNode).getSummaryNode(), c,

swift/ql/test/library-tests/dataflow/taint/libraries/TaintInline.expected

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
failures
22
testFailures
33
| int.swift:18:21:19:1 | // $ SPURIOUS: tainted=13\n | Fixed spurious result:tainted=13 |
4-
| int.swift:19:24:20:1 | // $ tainted=13\n | Missing result:tainted=13 |
54
| int.swift:33:21:34:1 | // $ SPURIOUS: tainted=28\n | Fixed spurious result:tainted=28 |
6-
| int.swift:34:24:35:1 | // $ tainted=28\n | Missing result:tainted=28 |
75
| int.swift:48:23:49:1 | // $ SPURIOUS: tainted=47\n | Fixed spurious result:tainted=47 |
8-
| int.swift:49:26:50:1 | // $ tainted=47\n | Missing result:tainted=47 |
96
| int.swift:84:20:85:1 | // $ SPURIOUS: tainted=83\n | Fixed spurious result:tainted=83 |
10-
| int.swift:85:23:86:1 | // $ tainted=83\n | Missing result:tainted=83 |
117
| int.swift:89:23:90:1 | // $ SPURIOUS: tainted=83\n | Fixed spurious result:tainted=83 |
12-
| int.swift:90:26:91:1 | // $ tainted=83\n | Missing result:tainted=83 |
138
| int.swift:132:20:133:1 | // $ tainted=131\n | Missing result:tainted=131 |
14-
| int.swift:133:23:134:1 | // $ tainted=131\n | Missing result:tainted=131 |
159
| int.swift:137:30:138:1 | // $ SPURIOUS: tainted=131\n | Fixed spurious result:tainted=131 |
16-
| int.swift:138:33:139:1 | // $ tainted=131\n | Missing result:tainted=131 |
1710
| int.swift:147:23:148:1 | // $ SPURIOUS: tainted=142\n | Fixed spurious result:tainted=142 |
18-
| int.swift:148:26:149:1 | // $ tainted=142\n | Missing result:tainted=142 |
1911
| string.swift:407:23:408:1 | // $ tainted=366\n | Missing result:tainted=366 |
2012
| string.swift:441:20:442:1 | // $ tainted=366\n | Missing result:tainted=366 |
2113
| string.swift:483:23:484:1 | // $ tainted=450\n | Missing result:tainted=450 |

0 commit comments

Comments
 (0)