Skip to content

Commit dd2ca0d

Browse files
committed
Swift: Effect on tests.
1 parent c1a4cb2 commit dd2ca0d

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

swift/ql/test/library-tests/dataflow/taint/core/Taint.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ edges
1313
| conversions.swift:46:19:46:39 | call to sourceInt(_:) | conversions.swift:46:12:46:40 | call to Double.init(_:) | provenance | |
1414
| conversions.swift:47:19:47:39 | call to sourceInt(_:) | conversions.swift:47:12:47:40 | call to String.init(_:) | provenance | |
1515
| conversions.swift:48:12:48:40 | call to String.init(_:) | conversions.swift:48:12:48:42 | .utf8 | provenance | |
16+
| conversions.swift:48:12:48:40 | call to String.init(_:) [Collection element] | conversions.swift:48:12:48:42 | .utf8 | provenance | |
1617
| conversions.swift:48:19:48:39 | call to sourceInt(_:) | conversions.swift:48:12:48:40 | call to String.init(_:) | provenance | |
18+
| conversions.swift:48:19:48:39 | call to sourceInt(_:) | conversions.swift:48:12:48:40 | call to String.init(_:) [Collection element] | provenance | |
1719
| conversions.swift:50:12:50:39 | [...] [Collection element] | conversions.swift:51:12:51:12 | arr | provenance | |
1820
| conversions.swift:50:12:50:39 | [...] [Collection element] | conversions.swift:52:12:52:12 | arr [Collection element] | provenance | |
1921
| conversions.swift:50:12:50:39 | [...] [Collection element] | conversions.swift:53:20:53:20 | arr [Collection element] | provenance | |
@@ -65,13 +67,19 @@ edges
6567
| conversions.swift:138:18:138:39 | call to sourceFloat(_:) | conversions.swift:138:12:138:40 | call to UInt8.init(_:) | provenance | |
6668
| conversions.swift:139:19:139:40 | call to sourceFloat(_:) | conversions.swift:139:12:139:41 | call to String.init(_:) | provenance | |
6769
| conversions.swift:140:12:140:41 | call to String.init(_:) | conversions.swift:140:12:140:43 | .utf8 | provenance | |
70+
| conversions.swift:140:12:140:41 | call to String.init(_:) [Collection element] | conversions.swift:140:12:140:43 | .utf8 | provenance | |
6871
| conversions.swift:140:19:140:40 | call to sourceFloat(_:) | conversions.swift:140:12:140:41 | call to String.init(_:) | provenance | |
72+
| conversions.swift:140:19:140:40 | call to sourceFloat(_:) | conversions.swift:140:12:140:41 | call to String.init(_:) [Collection element] | provenance | |
6973
| conversions.swift:141:19:141:42 | call to sourceFloat80(_:) | conversions.swift:141:12:141:43 | call to String.init(_:) | provenance | |
7074
| conversions.swift:142:12:142:43 | call to String.init(_:) | conversions.swift:142:12:142:45 | .utf8 | provenance | |
75+
| conversions.swift:142:12:142:43 | call to String.init(_:) [Collection element] | conversions.swift:142:12:142:45 | .utf8 | provenance | |
7176
| conversions.swift:142:19:142:42 | call to sourceFloat80(_:) | conversions.swift:142:12:142:43 | call to String.init(_:) | provenance | |
77+
| conversions.swift:142:19:142:42 | call to sourceFloat80(_:) | conversions.swift:142:12:142:43 | call to String.init(_:) [Collection element] | provenance | |
7278
| conversions.swift:143:19:143:41 | call to sourceDouble(_:) | conversions.swift:143:12:143:42 | call to String.init(_:) | provenance | |
7379
| conversions.swift:144:12:144:42 | call to String.init(_:) | conversions.swift:144:12:144:44 | .utf8 | provenance | |
80+
| conversions.swift:144:12:144:42 | call to String.init(_:) [Collection element] | conversions.swift:144:12:144:44 | .utf8 | provenance | |
7481
| conversions.swift:144:19:144:41 | call to sourceDouble(_:) | conversions.swift:144:12:144:42 | call to String.init(_:) | provenance | |
82+
| conversions.swift:144:19:144:41 | call to sourceDouble(_:) | conversions.swift:144:12:144:42 | call to String.init(_:) [Collection element] | provenance | |
7583
| conversions.swift:146:18:146:39 | call to sourceFloat(_:) | conversions.swift:146:12:146:40 | call to Float.init(_:) | provenance | |
7684
| conversions.swift:147:41:147:60 | call to sourceInt(_:) | conversions.swift:147:12:147:79 | call to Float.init(sign:exponent:significand:) | provenance | |
7785
| conversions.swift:148:57:148:78 | call to sourceFloat(_:) | conversions.swift:148:12:148:79 | call to Float.init(sign:exponent:significand:) | provenance | |
@@ -279,6 +287,7 @@ nodes
279287
| conversions.swift:47:12:47:40 | call to String.init(_:) | semmle.label | call to String.init(_:) |
280288
| conversions.swift:47:19:47:39 | call to sourceInt(_:) | semmle.label | call to sourceInt(_:) |
281289
| conversions.swift:48:12:48:40 | call to String.init(_:) | semmle.label | call to String.init(_:) |
290+
| conversions.swift:48:12:48:40 | call to String.init(_:) [Collection element] | semmle.label | call to String.init(_:) [Collection element] |
282291
| conversions.swift:48:12:48:42 | .utf8 | semmle.label | .utf8 |
283292
| conversions.swift:48:19:48:39 | call to sourceInt(_:) | semmle.label | call to sourceInt(_:) |
284293
| conversions.swift:50:12:50:39 | [...] [Collection element] | semmle.label | [...] [Collection element] |
@@ -363,16 +372,19 @@ nodes
363372
| conversions.swift:139:12:139:41 | call to String.init(_:) | semmle.label | call to String.init(_:) |
364373
| conversions.swift:139:19:139:40 | call to sourceFloat(_:) | semmle.label | call to sourceFloat(_:) |
365374
| conversions.swift:140:12:140:41 | call to String.init(_:) | semmle.label | call to String.init(_:) |
375+
| conversions.swift:140:12:140:41 | call to String.init(_:) [Collection element] | semmle.label | call to String.init(_:) [Collection element] |
366376
| conversions.swift:140:12:140:43 | .utf8 | semmle.label | .utf8 |
367377
| conversions.swift:140:19:140:40 | call to sourceFloat(_:) | semmle.label | call to sourceFloat(_:) |
368378
| conversions.swift:141:12:141:43 | call to String.init(_:) | semmle.label | call to String.init(_:) |
369379
| conversions.swift:141:19:141:42 | call to sourceFloat80(_:) | semmle.label | call to sourceFloat80(_:) |
370380
| conversions.swift:142:12:142:43 | call to String.init(_:) | semmle.label | call to String.init(_:) |
381+
| conversions.swift:142:12:142:43 | call to String.init(_:) [Collection element] | semmle.label | call to String.init(_:) [Collection element] |
371382
| conversions.swift:142:12:142:45 | .utf8 | semmle.label | .utf8 |
372383
| conversions.swift:142:19:142:42 | call to sourceFloat80(_:) | semmle.label | call to sourceFloat80(_:) |
373384
| conversions.swift:143:12:143:42 | call to String.init(_:) | semmle.label | call to String.init(_:) |
374385
| conversions.swift:143:19:143:41 | call to sourceDouble(_:) | semmle.label | call to sourceDouble(_:) |
375386
| conversions.swift:144:12:144:42 | call to String.init(_:) | semmle.label | call to String.init(_:) |
387+
| conversions.swift:144:12:144:42 | call to String.init(_:) [Collection element] | semmle.label | call to String.init(_:) [Collection element] |
376388
| conversions.swift:144:12:144:44 | .utf8 | semmle.label | .utf8 |
377389
| conversions.swift:144:19:144:41 | call to sourceDouble(_:) | semmle.label | call to sourceDouble(_:) |
378390
| conversions.swift:146:12:146:40 | call to Float.init(_:) | semmle.label | call to Float.init(_:) |

swift/ql/test/library-tests/dataflow/taint/libraries/custom.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ func testCustom() {
115115
sink(arg: mc7)
116116
sink(arg: mc7[0])
117117
mc7.append(contentsOf: taintedArray)
118-
sink(arg: mc7) // $ MISSING: tainted=data10
119-
sink(arg: mc7[0]) // $ MISSING: tainted=data10
118+
sink(arg: mc7) // $ tainted=data10
119+
sink(arg: mc7[0]) // $ tainted=data10
120120
}

swift/ql/test/library-tests/dataflow/taint/libraries/files.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func test_files(e1: Encoder) {
125125
sink(filePath: FilePath(cString: sourceCString())) // $ tainted=125
126126
sink(filePath: FilePath(root: FilePath.Root("/"), [FilePath.Component("my")!, FilePath.Component("path")!]))
127127
sink(filePath: FilePath(root: FilePath.Root(sourceString()), [FilePath.Component("my")!, FilePath.Component("path")!])) // $ tainted=127
128-
sink(filePath: FilePath(root: FilePath.Root("/"), [FilePath.Component("my")!, FilePath.Component(sourceString())!])) // $ MISSING: tainted=
128+
sink(filePath: FilePath(root: FilePath.Root("/"), [FilePath.Component("my")!, FilePath.Component(sourceString())!])) // $ tainted=128
129129

130130
// --- FilePath methods ---
131131

swift/ql/test/library-tests/dataflow/taint/libraries/set.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func testSet(ix: Int) {
2828
sink(arg: taintedSet.max()!) // $ tainted=t1
2929
sink(arg: taintedSet.firstIndex(of: source("t2"))!)
3030
sink(arg: taintedSet[taintedSet.firstIndex(of: source("t3"))!]) // $ tainted=t1
31-
sink(arg: taintedSet.first!) // $ MISSING: tainted=t1
31+
sink(arg: taintedSet.first!) // $ tainted=t1
3232
for elem in taintedSet {
3333
sink(arg: elem) // $ tainted=t1
3434
}
@@ -100,7 +100,7 @@ func testSet(ix: Int) {
100100
sink(arg: taintedSet.sorted().randomElement()!) // $ tainted=t1
101101
sink(arg: taintedSet.shuffled().randomElement()!) // $ tainted=t1
102102

103-
sink(arg: taintedSet.lazy[taintedSet.firstIndex(of: source("t11"))!]) // $ MISSING: tainted=t1
103+
sink(arg: taintedSet.lazy[taintedSet.firstIndex(of: source("t11"))!]) // $ tainted=t1
104104

105105
var it = taintedSet.makeIterator()
106106
sink(arg: it.next()!) // $ tainted=t1

swift/ql/test/library-tests/dataflow/taint/libraries/url.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func taintThroughURL() {
292292
sink(arg: URL(fileURLWithFileSystemRepresentation: 0 as! UnsafePointer<Int8>, isDirectory: false, relativeTo: urlTainted)) // $ tainted=210
293293
let _ = tainted.withCString({
294294
ptrTainted in
295-
sink(arg: URL(fileURLWithFileSystemRepresentation: ptrTainted, isDirectory: false, relativeTo: nil)) // $ MISSING: tainted=210
295+
sink(arg: URL(fileURLWithFileSystemRepresentation: ptrTainted, isDirectory: false, relativeTo: nil)) // $ tainted=210
296296
})
297297

298298
sink(arg: URL(fileReferenceLiteralResourceName: tainted)) // $ tainted=210
@@ -339,12 +339,12 @@ func taintThroughURL() {
339339
sink(arg: urlTainted.appending(component: clean)) // $ tainted=210
340340
sink(arg: urlClean.appending(component: tainted)) // $ tainted=210
341341
sink(arg: urlTainted.appending(components: clean)) // $ tainted=210
342-
sink(arg: urlClean.appending(components: tainted)) // $ MISSING: tainted=210
343-
sink(arg: urlClean.appending(components: clean, tainted)) // $ MISSING: tainted=210
342+
sink(arg: urlClean.appending(components: tainted)) // $ tainted=210
343+
sink(arg: urlClean.appending(components: clean, tainted)) // $ tainted=210
344344
sink(arg: urlTainted.appending(path: clean)) // $ tainted=210
345345
sink(arg: urlClean.appending(path: tainted)) // $ tainted=210
346346
sink(arg: urlTainted.appending(queryItems: [])) // $ tainted=210
347-
sink(arg: urlClean.appending(queryItems: [source() as! URLQueryItem])) // $ MISSING: tainted=210
347+
sink(arg: urlClean.appending(queryItems: [source() as! URLQueryItem])) // $ tainted=347
348348

349349
sink(arg: URL(filePath: tainted)) // $ tainted=210
350350
sink(arg: URL(filePath: tainted, relativeTo: nil)) // $ tainted=210
@@ -403,19 +403,19 @@ func taintThroughURL() {
403403

404404
var url7 = URL(string: clean)!
405405
url7.append(components: tainted)
406-
sink(arg: url7) // $ MISSING: tainted=210
406+
sink(arg: url7) // $ tainted=210
407407

408408
var url8 = URL(string: clean)!
409409
url8.append(components: clean, tainted)
410-
sink(arg: url8) // $ MISSING: tainted=210
410+
sink(arg: url8) // $ tainted=210
411411

412412
var url9 = URL(string: clean)!
413413
url9.append(path: tainted)
414414
sink(arg: url9) // $ tainted=210
415415

416416
var url10 = URL(string: clean)!
417417
url10.append(queryItems: [source() as! URLQueryItem])
418-
sink(arg: url10) // $ MISSING: tainted=210
418+
sink(arg: url10) // $ tainted=417
419419

420420
sink(data: try! urlTainted.bookmarkData()) // $ tainted=210
421421
sink(data: try! URL.bookmarkData(withContentsOf: urlTainted)) // $ tainted=210

0 commit comments

Comments
 (0)