mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Swift: Add a test case for return values from closures.
This commit is contained in:
@@ -496,3 +496,19 @@ func taintUrlAsync() async throws {
|
||||
sink(string: line) // $ MISSING: tainted=490
|
||||
}
|
||||
}
|
||||
|
||||
func closureReturnValue() {
|
||||
let url = URL(string: "http://example.com/")!
|
||||
|
||||
let r1 = url.withUnsafeFileSystemRepresentation({
|
||||
ptr in
|
||||
return "abc"
|
||||
})
|
||||
sink(string: r1)
|
||||
|
||||
let r2 = url.withUnsafeFileSystemRepresentation({
|
||||
ptr in
|
||||
return source() as! String
|
||||
})
|
||||
sink(string: r2) // $ tainted=511
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user