Skip to content

Commit 99aa754

Browse files
committed
Swift: Add tests for UIImage.
1 parent da648b1 commit 99aa754

File tree

1 file changed

+20
-0
lines changed
  • swift/ql/test/library-tests/dataflow/taint/libraries

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ class UIScene {
4141
class OpenURLOptions {}
4242
}
4343

44+
struct CGFloat { }
45+
46+
class Data {
47+
init<S>(_ elements: S) {}
48+
}
49+
50+
class UIImage {
51+
init?(data: Data) { }
52+
init?(data: Data, scale: CGFloat) { }
53+
}
54+
4455
// --- tests ---
4556

4657
func source(_ label: String) -> Any { return "" }
@@ -75,3 +86,12 @@ func testConnectionOptions() {
7586
sink(safe.sourceApplication)
7687
sink(tainted.sourceApplication)
7788
}
89+
90+
func testUIImage(scale: CGFloat) {
91+
let taintedData = source("UIImage") as! Data
92+
93+
sink(UIImage(data: Data(0))!)
94+
sink(UIImage(data: Data(taintedData))!) // $ MISSING: tainted=UIImage
95+
sink(UIImage(data: Data(0), scale: scale)!)
96+
sink(UIImage(data: Data(taintedData), scale: scale)!) // $ MISSING: tainted=UIImage
97+
}

0 commit comments

Comments
 (0)