Skip to content

Commit 0973fb3

Browse files
committed
Swift: Model UnsafeMutablePointer.init(mutating:).
1 parent 32c113b commit 0973fb3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

swift/ql/lib/codeql/swift/frameworks/StandardLibrary/PointerTypes.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import swift
7+
private import codeql.swift.dataflow.ExternalFlow
78

89
/**
910
* A Swift unsafe typed pointer type such as `UnsafePointer`,
@@ -57,3 +58,16 @@ class CVaListPointerType extends NominalType {
5758
class ManagedBufferPointerType extends BoundGenericType {
5859
ManagedBufferPointerType() { this.getName().matches("ManagedBufferPointer<%") }
5960
}
61+
62+
63+
/**
64+
* A model for pointer members that permit taint flow.
65+
*/
66+
private class PointerSummaries extends SummaryModelCsv {
67+
override predicate row(string row) {
68+
row =
69+
[
70+
";UnsafeMutablePointer;true;init(mutating:);;;Argument[0];ReturnValue;taint",
71+
]
72+
}
73+
}

swift/ql/lib/codeql/swift/frameworks/StandardLibrary/StandardLibrary.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ private import NsData
1212
private import NsObject
1313
private import NsString
1414
private import NsUrl
15+
private import PointerTypes
1516
private import Sequence
1617
private import String
1718
private import Url

0 commit comments

Comments
 (0)