mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Swift: Add a test revealing the issue in pure dataflow.
This commit is contained in:
@@ -135,6 +135,28 @@ edges
|
||||
| test2.swift:69:10:69:10 | key | test2.swift:70:19:70:19 | key | provenance | |
|
||||
| test2.swift:69:25:69:25 | call to makeIterator() [Collection element, Tuple element at index 0] | test2.swift:69:5:69:5 | $generator [Collection element, Tuple element at index 0] | provenance | |
|
||||
| test2.swift:69:25:69:25 | d4 [Collection element, Tuple element at index 0] | test2.swift:69:25:69:25 | call to makeIterator() [Collection element, Tuple element at index 0] | provenance | |
|
||||
| test2.swift:76:14:76:47 | [...] [Collection element] | test2.swift:82:19:82:19 | a1 [Collection element] | provenance | |
|
||||
| test2.swift:76:14:76:47 | [...] [Collection element] | test2.swift:84:20:84:20 | a1 [Collection element] | provenance | |
|
||||
| test2.swift:76:30:76:46 | call to source(_:) | test2.swift:76:14:76:47 | [...] [Collection element] | provenance | |
|
||||
| test2.swift:82:19:82:19 | a1 [Collection element] | test2.swift:82:19:82:24 | ...[...] | provenance | |
|
||||
| test2.swift:84:5:84:5 | $generator [Collection element, Tuple element at index 1] | test2.swift:84:5:84:5 | call to next() [some:0, Tuple element at index 1] | provenance | |
|
||||
| test2.swift:84:5:84:5 | call to next() [some:0, Tuple element at index 1] | test2.swift:84:9:84:15 | (...) [Tuple element at index 1] | provenance | |
|
||||
| test2.swift:84:9:84:15 | (...) [Tuple element at index 1] | test2.swift:84:14:84:14 | v | provenance | |
|
||||
| test2.swift:84:14:84:14 | v | test2.swift:86:19:86:19 | v | provenance | |
|
||||
| test2.swift:84:20:84:20 | a1 [Collection element] | test2.swift:84:20:84:34 | call to enumerated() [Collection element, Tuple element at index 1] | provenance | |
|
||||
| test2.swift:84:20:84:34 | call to enumerated() [Collection element, Tuple element at index 1] | test2.swift:84:20:84:34 | call to makeIterator() [Collection element, Tuple element at index 1] | provenance | |
|
||||
| test2.swift:84:20:84:34 | call to makeIterator() [Collection element, Tuple element at index 1] | test2.swift:84:5:84:5 | $generator [Collection element, Tuple element at index 1] | provenance | |
|
||||
| test2.swift:93:5:93:5 | [post] a2 [Collection element] | test2.swift:99:19:99:19 | a2 [Collection element] | provenance | |
|
||||
| test2.swift:93:5:93:5 | [post] a2 [Collection element] | test2.swift:101:20:101:20 | a2 [Collection element] | provenance | |
|
||||
| test2.swift:93:13:93:29 | call to source(_:) | test2.swift:93:5:93:5 | [post] a2 [Collection element] | provenance | |
|
||||
| test2.swift:99:19:99:19 | a2 [Collection element] | test2.swift:99:19:99:24 | ...[...] | provenance | |
|
||||
| test2.swift:101:5:101:5 | $generator [Collection element, Tuple element at index 1] | test2.swift:101:5:101:5 | call to next() [some:0, Tuple element at index 1] | provenance | |
|
||||
| test2.swift:101:5:101:5 | call to next() [some:0, Tuple element at index 1] | test2.swift:101:9:101:15 | (...) [Tuple element at index 1] | provenance | |
|
||||
| test2.swift:101:9:101:15 | (...) [Tuple element at index 1] | test2.swift:101:14:101:14 | v | provenance | |
|
||||
| test2.swift:101:14:101:14 | v | test2.swift:103:19:103:19 | v | provenance | |
|
||||
| test2.swift:101:20:101:20 | a2 [Collection element] | test2.swift:101:20:101:34 | call to enumerated() [Collection element, Tuple element at index 1] | provenance | |
|
||||
| test2.swift:101:20:101:34 | call to enumerated() [Collection element, Tuple element at index 1] | test2.swift:101:20:101:34 | call to makeIterator() [Collection element, Tuple element at index 1] | provenance | |
|
||||
| test2.swift:101:20:101:34 | call to makeIterator() [Collection element, Tuple element at index 1] | test2.swift:101:5:101:5 | $generator [Collection element, Tuple element at index 1] | provenance | |
|
||||
| test.swift:6:19:6:26 | call to source() | test.swift:7:15:7:15 | t1 | provenance | |
|
||||
| test.swift:6:19:6:26 | call to source() | test.swift:9:15:9:15 | t1 | provenance | |
|
||||
| test.swift:6:19:6:26 | call to source() | test.swift:10:15:10:15 | t2 | provenance | |
|
||||
@@ -884,6 +906,30 @@ nodes
|
||||
| test2.swift:69:25:69:25 | call to makeIterator() [Collection element, Tuple element at index 0] | semmle.label | call to makeIterator() [Collection element, Tuple element at index 0] |
|
||||
| test2.swift:69:25:69:25 | d4 [Collection element, Tuple element at index 0] | semmle.label | d4 [Collection element, Tuple element at index 0] |
|
||||
| test2.swift:70:19:70:19 | key | semmle.label | key |
|
||||
| test2.swift:76:14:76:47 | [...] [Collection element] | semmle.label | [...] [Collection element] |
|
||||
| test2.swift:76:30:76:46 | call to source(_:) | semmle.label | call to source(_:) |
|
||||
| test2.swift:82:19:82:19 | a1 [Collection element] | semmle.label | a1 [Collection element] |
|
||||
| test2.swift:82:19:82:24 | ...[...] | semmle.label | ...[...] |
|
||||
| test2.swift:84:5:84:5 | $generator [Collection element, Tuple element at index 1] | semmle.label | $generator [Collection element, Tuple element at index 1] |
|
||||
| test2.swift:84:5:84:5 | call to next() [some:0, Tuple element at index 1] | semmle.label | call to next() [some:0, Tuple element at index 1] |
|
||||
| test2.swift:84:9:84:15 | (...) [Tuple element at index 1] | semmle.label | (...) [Tuple element at index 1] |
|
||||
| test2.swift:84:14:84:14 | v | semmle.label | v |
|
||||
| test2.swift:84:20:84:20 | a1 [Collection element] | semmle.label | a1 [Collection element] |
|
||||
| test2.swift:84:20:84:34 | call to enumerated() [Collection element, Tuple element at index 1] | semmle.label | call to enumerated() [Collection element, Tuple element at index 1] |
|
||||
| test2.swift:84:20:84:34 | call to makeIterator() [Collection element, Tuple element at index 1] | semmle.label | call to makeIterator() [Collection element, Tuple element at index 1] |
|
||||
| test2.swift:86:19:86:19 | v | semmle.label | v |
|
||||
| test2.swift:93:5:93:5 | [post] a2 [Collection element] | semmle.label | [post] a2 [Collection element] |
|
||||
| test2.swift:93:13:93:29 | call to source(_:) | semmle.label | call to source(_:) |
|
||||
| test2.swift:99:19:99:19 | a2 [Collection element] | semmle.label | a2 [Collection element] |
|
||||
| test2.swift:99:19:99:24 | ...[...] | semmle.label | ...[...] |
|
||||
| test2.swift:101:5:101:5 | $generator [Collection element, Tuple element at index 1] | semmle.label | $generator [Collection element, Tuple element at index 1] |
|
||||
| test2.swift:101:5:101:5 | call to next() [some:0, Tuple element at index 1] | semmle.label | call to next() [some:0, Tuple element at index 1] |
|
||||
| test2.swift:101:9:101:15 | (...) [Tuple element at index 1] | semmle.label | (...) [Tuple element at index 1] |
|
||||
| test2.swift:101:14:101:14 | v | semmle.label | v |
|
||||
| test2.swift:101:20:101:20 | a2 [Collection element] | semmle.label | a2 [Collection element] |
|
||||
| test2.swift:101:20:101:34 | call to enumerated() [Collection element, Tuple element at index 1] | semmle.label | call to enumerated() [Collection element, Tuple element at index 1] |
|
||||
| test2.swift:101:20:101:34 | call to makeIterator() [Collection element, Tuple element at index 1] | semmle.label | call to makeIterator() [Collection element, Tuple element at index 1] |
|
||||
| test2.swift:103:19:103:19 | v | semmle.label | v |
|
||||
| test.swift:6:19:6:26 | call to source() | semmle.label | call to source() |
|
||||
| test.swift:7:15:7:15 | t1 | semmle.label | t1 |
|
||||
| test.swift:9:15:9:15 | t1 | semmle.label | t1 |
|
||||
@@ -1615,6 +1661,10 @@ subpaths
|
||||
| test2.swift:53:15:53:28 | ... ??(_:_:) ... | test2.swift:46:17:46:33 | call to source(_:) | test2.swift:53:15:53:28 | ... ??(_:_:) ... | result |
|
||||
| test2.swift:54:15:54:24 | ...! | test2.swift:46:17:46:33 | call to source(_:) | test2.swift:54:15:54:24 | ...! | result |
|
||||
| test2.swift:70:19:70:19 | key | test2.swift:60:8:60:24 | call to source(_:) | test2.swift:70:19:70:19 | key | result |
|
||||
| test2.swift:82:19:82:24 | ...[...] | test2.swift:76:30:76:46 | call to source(_:) | test2.swift:82:19:82:24 | ...[...] | result |
|
||||
| test2.swift:86:19:86:19 | v | test2.swift:76:30:76:46 | call to source(_:) | test2.swift:86:19:86:19 | v | result |
|
||||
| test2.swift:99:19:99:24 | ...[...] | test2.swift:93:13:93:29 | call to source(_:) | test2.swift:99:19:99:24 | ...[...] | result |
|
||||
| test2.swift:103:19:103:19 | v | test2.swift:93:13:93:29 | call to source(_:) | test2.swift:103:19:103:19 | v | result |
|
||||
| test.swift:7:15:7:15 | t1 | test.swift:6:19:6:26 | call to source() | test.swift:7:15:7:15 | t1 | result |
|
||||
| test.swift:9:15:9:15 | t1 | test.swift:6:19:6:26 | call to source() | test.swift:9:15:9:15 | t1 | result |
|
||||
| test.swift:10:15:10:15 | t2 | test.swift:6:19:6:26 | call to source() | test.swift:10:15:10:15 | t2 | result |
|
||||
|
||||
@@ -161,6 +161,87 @@
|
||||
| test2.swift:69:25:69:25 | $generator | test2.swift:69:25:69:25 | SSA def($generator) |
|
||||
| test2.swift:69:25:69:25 | SSA def($generator) | test2.swift:69:5:69:5 | $generator |
|
||||
| test2.swift:69:25:69:25 | call to makeIterator() | test2.swift:69:25:69:25 | $generator |
|
||||
| test2.swift:76:9:76:9 | SSA def(a1) | test2.swift:78:14:78:14 | a1 |
|
||||
| test2.swift:76:9:76:9 | a1 | test2.swift:76:9:76:9 | SSA def(a1) |
|
||||
| test2.swift:76:14:76:47 | [...] | test2.swift:76:9:76:9 | a1 |
|
||||
| test2.swift:78:5:78:5 | $v$generator | test2.swift:78:5:78:5 | &... |
|
||||
| test2.swift:78:5:78:5 | &... | test2.swift:78:5:78:5 | $v$generator |
|
||||
| test2.swift:78:5:78:5 | [post] $v$generator | test2.swift:78:5:78:5 | &... |
|
||||
| test2.swift:78:9:78:9 | SSA def(v) | test2.swift:79:19:79:19 | v |
|
||||
| test2.swift:78:9:78:9 | v | test2.swift:78:9:78:9 | SSA def(v) |
|
||||
| test2.swift:78:14:78:14 | $v$generator | test2.swift:78:14:78:14 | SSA def($v$generator) |
|
||||
| test2.swift:78:14:78:14 | SSA def($v$generator) | test2.swift:78:5:78:5 | $v$generator |
|
||||
| test2.swift:78:14:78:14 | [post] a1 | test2.swift:81:21:81:21 | a1 |
|
||||
| test2.swift:78:14:78:14 | a1 | test2.swift:81:21:81:21 | a1 |
|
||||
| test2.swift:78:14:78:14 | call to makeIterator() | test2.swift:78:14:78:14 | $v$generator |
|
||||
| test2.swift:81:5:81:5 | $ix$generator | test2.swift:81:5:81:5 | &... |
|
||||
| test2.swift:81:5:81:5 | &... | test2.swift:81:5:81:5 | $ix$generator |
|
||||
| test2.swift:81:5:81:5 | [post] $ix$generator | test2.swift:81:5:81:5 | &... |
|
||||
| test2.swift:81:9:81:9 | SSA def(ix) | test2.swift:82:22:82:22 | ix |
|
||||
| test2.swift:81:9:81:9 | ix | test2.swift:81:9:81:9 | SSA def(ix) |
|
||||
| test2.swift:81:15:81:15 | $ix$generator | test2.swift:81:15:81:15 | SSA def($ix$generator) |
|
||||
| test2.swift:81:15:81:15 | SSA def($ix$generator) | test2.swift:81:5:81:5 | $ix$generator |
|
||||
| test2.swift:81:15:81:24 | call to makeIterator() | test2.swift:81:15:81:15 | $ix$generator |
|
||||
| test2.swift:81:21:81:21 | [post] a1 | test2.swift:82:19:82:19 | a1 |
|
||||
| test2.swift:81:21:81:21 | [post] a1 | test2.swift:84:20:84:20 | a1 |
|
||||
| test2.swift:81:21:81:21 | a1 | test2.swift:82:19:82:19 | a1 |
|
||||
| test2.swift:81:21:81:21 | a1 | test2.swift:84:20:84:20 | a1 |
|
||||
| test2.swift:82:19:82:19 | &... | test2.swift:82:19:82:19 | a1 |
|
||||
| test2.swift:82:19:82:19 | &... | test2.swift:84:20:84:20 | a1 |
|
||||
| test2.swift:82:19:82:19 | [post] a1 | test2.swift:82:19:82:19 | &... |
|
||||
| test2.swift:82:19:82:19 | a1 | test2.swift:82:19:82:19 | &... |
|
||||
| test2.swift:84:5:84:5 | $generator | test2.swift:84:5:84:5 | &... |
|
||||
| test2.swift:84:5:84:5 | &... | test2.swift:84:5:84:5 | $generator |
|
||||
| test2.swift:84:5:84:5 | [post] $generator | test2.swift:84:5:84:5 | &... |
|
||||
| test2.swift:84:10:84:10 | SSA def(ix) | test2.swift:85:19:85:19 | ix |
|
||||
| test2.swift:84:10:84:10 | ix | test2.swift:84:10:84:10 | SSA def(ix) |
|
||||
| test2.swift:84:14:84:14 | SSA def(v) | test2.swift:86:19:86:19 | v |
|
||||
| test2.swift:84:14:84:14 | v | test2.swift:84:14:84:14 | SSA def(v) |
|
||||
| test2.swift:84:20:84:20 | $generator | test2.swift:84:20:84:20 | SSA def($generator) |
|
||||
| test2.swift:84:20:84:20 | SSA def($generator) | test2.swift:84:5:84:5 | $generator |
|
||||
| test2.swift:84:20:84:34 | call to makeIterator() | test2.swift:84:20:84:20 | $generator |
|
||||
| test2.swift:91:9:91:9 | SSA def(a2) | test2.swift:93:5:93:5 | a2 |
|
||||
| test2.swift:91:9:91:9 | a2 | test2.swift:91:9:91:9 | SSA def(a2) |
|
||||
| test2.swift:91:14:91:33 | [...] | test2.swift:91:9:91:9 | a2 |
|
||||
| test2.swift:93:5:93:5 | &... | test2.swift:95:14:95:14 | a2 |
|
||||
| test2.swift:93:5:93:5 | [post] a2 | test2.swift:93:5:93:5 | &... |
|
||||
| test2.swift:93:5:93:5 | a2 | test2.swift:93:5:93:5 | &... |
|
||||
| test2.swift:95:5:95:5 | $v$generator | test2.swift:95:5:95:5 | &... |
|
||||
| test2.swift:95:5:95:5 | &... | test2.swift:95:5:95:5 | $v$generator |
|
||||
| test2.swift:95:5:95:5 | [post] $v$generator | test2.swift:95:5:95:5 | &... |
|
||||
| test2.swift:95:9:95:9 | SSA def(v) | test2.swift:96:19:96:19 | v |
|
||||
| test2.swift:95:9:95:9 | v | test2.swift:95:9:95:9 | SSA def(v) |
|
||||
| test2.swift:95:14:95:14 | $v$generator | test2.swift:95:14:95:14 | SSA def($v$generator) |
|
||||
| test2.swift:95:14:95:14 | SSA def($v$generator) | test2.swift:95:5:95:5 | $v$generator |
|
||||
| test2.swift:95:14:95:14 | [post] a2 | test2.swift:98:21:98:21 | a2 |
|
||||
| test2.swift:95:14:95:14 | a2 | test2.swift:98:21:98:21 | a2 |
|
||||
| test2.swift:95:14:95:14 | call to makeIterator() | test2.swift:95:14:95:14 | $v$generator |
|
||||
| test2.swift:98:5:98:5 | $ix$generator | test2.swift:98:5:98:5 | &... |
|
||||
| test2.swift:98:5:98:5 | &... | test2.swift:98:5:98:5 | $ix$generator |
|
||||
| test2.swift:98:5:98:5 | [post] $ix$generator | test2.swift:98:5:98:5 | &... |
|
||||
| test2.swift:98:9:98:9 | SSA def(ix) | test2.swift:99:22:99:22 | ix |
|
||||
| test2.swift:98:9:98:9 | ix | test2.swift:98:9:98:9 | SSA def(ix) |
|
||||
| test2.swift:98:15:98:15 | $ix$generator | test2.swift:98:15:98:15 | SSA def($ix$generator) |
|
||||
| test2.swift:98:15:98:15 | SSA def($ix$generator) | test2.swift:98:5:98:5 | $ix$generator |
|
||||
| test2.swift:98:15:98:24 | call to makeIterator() | test2.swift:98:15:98:15 | $ix$generator |
|
||||
| test2.swift:98:21:98:21 | [post] a2 | test2.swift:99:19:99:19 | a2 |
|
||||
| test2.swift:98:21:98:21 | [post] a2 | test2.swift:101:20:101:20 | a2 |
|
||||
| test2.swift:98:21:98:21 | a2 | test2.swift:99:19:99:19 | a2 |
|
||||
| test2.swift:98:21:98:21 | a2 | test2.swift:101:20:101:20 | a2 |
|
||||
| test2.swift:99:19:99:19 | &... | test2.swift:99:19:99:19 | a2 |
|
||||
| test2.swift:99:19:99:19 | &... | test2.swift:101:20:101:20 | a2 |
|
||||
| test2.swift:99:19:99:19 | [post] a2 | test2.swift:99:19:99:19 | &... |
|
||||
| test2.swift:99:19:99:19 | a2 | test2.swift:99:19:99:19 | &... |
|
||||
| test2.swift:101:5:101:5 | $generator | test2.swift:101:5:101:5 | &... |
|
||||
| test2.swift:101:5:101:5 | &... | test2.swift:101:5:101:5 | $generator |
|
||||
| test2.swift:101:5:101:5 | [post] $generator | test2.swift:101:5:101:5 | &... |
|
||||
| test2.swift:101:10:101:10 | SSA def(ix) | test2.swift:102:19:102:19 | ix |
|
||||
| test2.swift:101:10:101:10 | ix | test2.swift:101:10:101:10 | SSA def(ix) |
|
||||
| test2.swift:101:14:101:14 | SSA def(v) | test2.swift:103:19:103:19 | v |
|
||||
| test2.swift:101:14:101:14 | v | test2.swift:101:14:101:14 | SSA def(v) |
|
||||
| test2.swift:101:20:101:20 | $generator | test2.swift:101:20:101:20 | SSA def($generator) |
|
||||
| test2.swift:101:20:101:20 | SSA def($generator) | test2.swift:101:5:101:5 | $generator |
|
||||
| test2.swift:101:20:101:34 | call to makeIterator() | test2.swift:101:20:101:20 | $generator |
|
||||
| test.swift:5:9:5:13 | ... as ... | test.swift:5:9:5:9 | t2 |
|
||||
| test.swift:6:9:6:9 | SSA def(t1) | test.swift:7:15:7:15 | t1 |
|
||||
| test.swift:6:9:6:9 | t1 | test.swift:6:9:6:9 | SSA def(t1) |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
func source(_ label: String) -> String { return ""; }
|
||||
func sink(arg: String) {}
|
||||
func sink<T>(arg: T) {}
|
||||
|
||||
func testDicts() {
|
||||
let d1 = ["a": "apple", "b": "banana", "c": source("source1")]
|
||||
@@ -71,3 +71,35 @@ func testDicts4() {
|
||||
sink(arg: value)
|
||||
}
|
||||
}
|
||||
|
||||
func testArrays1() {
|
||||
var a1 = ["a", "b", "c", source("source5")]
|
||||
|
||||
for v in a1 {
|
||||
sink(arg: v) // $ MISSING: flow=source5
|
||||
}
|
||||
for ix in 0 ..< a1.count {
|
||||
sink(arg: a1[ix]) // $ flow=source5
|
||||
}
|
||||
for (ix, v) in a1.enumerated() {
|
||||
sink(arg: ix)
|
||||
sink(arg: v) // $ flow=source5
|
||||
}
|
||||
}
|
||||
|
||||
func testArrays2() {
|
||||
var a2 = ["a", "b", "c", "d"]
|
||||
|
||||
a2[1] = source("source6")
|
||||
|
||||
for v in a2 {
|
||||
sink(arg: v) // $ MISSING: flow=source6
|
||||
}
|
||||
for ix in 0 ..< a2.count {
|
||||
sink(arg: a2[ix]) // $ flow=source6
|
||||
}
|
||||
for (ix, v) in a2.enumerated() {
|
||||
sink(arg: ix)
|
||||
sink(arg: v) // $ flow=source6
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user