Skip to content

Commit 4b970ff

Browse files
committed
Swift: update models for array/collection content
1 parent 3b7295b commit 4b970ff

File tree

5 files changed

+14
-24
lines changed

5 files changed

+14
-24
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ private class ArraySummaries extends SummaryModelCsv {
1919
override predicate row(string row) {
2020
row =
2121
[
22-
";Array;true;insert(_:at:);;;Argument[0];Argument[-1].ArrayElement;value",
22+
";Array;true;insert(_:at:);;;Argument[0];Argument[-1].CollectionElement;value",
2323
";Array;true;insert(_:at:);;;Argument[1];Argument[-1];taint",
2424
";Array;true;withUnsafeBufferPointer(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
25-
";Array;true;withUnsafeBufferPointer(_:);;;Argument[-1].ArrayElement;Argument[0].Parameter[0].CollectionElement;value",
25+
";Array;true;withUnsafeBufferPointer(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;value",
2626
";Array;true;withUnsafeBufferPointer(_:);;;Argument[0].ReturnValue;ReturnValue;value",
2727
";Array;true;withUnsafeMutableBufferPointer(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
28-
";Array;true;withUnsafeMutableBufferPointer(_:);;;Argument[-1].ArrayElement;Argument[0].Parameter[0].CollectionElement;value",
28+
";Array;true;withUnsafeMutableBufferPointer(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;value",
2929
";Array;true;withUnsafeMutableBufferPointer(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1].CollectionElement;value",
3030
";Array;true;withUnsafeMutableBufferPointer(_:);;;Argument[0].ReturnValue;ReturnValue;value",
3131
";Array;true;withUnsafeBytes(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
32-
";Array;true;withUnsafeBytes(_:);;;Argument[-1].ArrayElement;Argument[0].Parameter[0].CollectionElement;taint",
32+
";Array;true;withUnsafeBytes(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;taint",
3333
";Array;true;withUnsafeBytes(_:);;;Argument[0].ReturnValue;ReturnValue;value",
3434
";Array;true;withUnsafeMutableBytes(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
35-
";Array;true;withUnsafeMutableBytes(_:);;;Argument[-1].ArrayElement;Argument[0].Parameter[0].CollectionElement;taint",
35+
";Array;true;withUnsafeMutableBytes(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;taint",
3636
";Array;true;withUnsafeMutableBytes(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1].CollectionElement;value",
3737
";Array;true;withUnsafeMutableBytes(_:);;;Argument[0].ReturnValue;ReturnValue;value",
3838
";ContiguousArray;true;withUnsafeBufferPointer(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ private class CollectionSummaries extends SummaryModelCsv {
2727
";Collection;true;removeFirst();;;Argument[-1];ReturnValue;taint",
2828
";Collection;true;popFirst();;;Argument[-1];ReturnValue;taint",
2929
";Collection;true;randomElement();;;Argument[-1].CollectionElement;ReturnValue.OptionalSome;value",
30-
";Collection;true;randomElement();;;Argument[-1].ArrayElement;ReturnValue.OptionalSome;value",
3130
";RangeReplaceableCollection;true;append(_:);;;Argument[0];Argument[-1];taint",
3231
";RangeReplaceableCollection;true;append(contentsOf:);;;Argument[0];Argument[-1];taint",
3332
";RangeReplaceableCollection;true;remove(at:);;;Argument[-1];ReturnValue;taint",
@@ -38,7 +37,6 @@ private class CollectionSummaries extends SummaryModelCsv {
3837
";BidirectionalCollection;true;last(where:);;;Argument[-1];ReturnValue;taint",
3938
";BidirectionalCollection;true;popLast();;;Argument[-1];ReturnValue;taint",
4039
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
41-
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[-1].ArrayElement;Argument[0].Parameter[0].CollectionElement;value",
4240
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;value",
4341
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1].CollectionElement;value",
4442
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[0].ReturnValue;ReturnValue.OptionalSome;value",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ private class SequenceSummaries extends SummaryModelCsv {
2626
";Sequence;true;joined(separator:);;;Argument[-1..0];ReturnValue;taint",
2727
";Sequence;true;first(where:);;;Argument[-1];ReturnValue;taint",
2828
";Sequence;true;withContiguousStorageIfAvailable(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
29-
";Sequence;true;withContiguousStorageIfAvailable(_:);;;Argument[-1].ArrayElement;Argument[0].Parameter[0].CollectionElement;value",
3029
";Sequence;true;withContiguousStorageIfAvailable(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;value",
3130
";Sequence;true;withContiguousStorageIfAvailable(_:);;;Argument[0].ReturnValue;ReturnValue.OptionalSome;value",
3231
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private class SetSummaries extends SummaryModelCsv {
1414
";Set;true;insert(_:);;;Argument[-1].CollectionElement;ReturnValue.TupleElement[1];value",
1515
";Set;true;insert(_:);;;Argument[0];Argument[-1].CollectionElement;value",
1616
";Set;true;insert(_:);;;Argument[0];ReturnValue.TupleElement[1];value",
17-
";Set;true;init(_:);;;Argument[0].ArrayElement;ReturnValue.CollectionElement;value"
17+
";Set;true;init(_:);;;Argument[0].CollectionElement;ReturnValue.CollectionElement;value"
1818
]
1919
}
2020
}

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ private class StringSummaries extends SummaryModelCsv {
3434
row =
3535
[
3636
";StringProtocol;true;init(cString:);;;Argument[0];ReturnValue;taint",
37-
";StringProtocol;true;init(cString:);;;Argument[0].ArrayElement;ReturnValue;taint",
3837
";StringProtocol;true;init(cString:);;;Argument[0].CollectionElement;ReturnValue;taint",
3938
";StringProtocol;true;init(decoding:as:);;;Argument[0];ReturnValue;taint",
4039
";StringProtocol;true;init(decodingCString:as:);;;Argument[0].OptionalSome.CollectionElement;ReturnValue.OptionalSome.TupleElement[0];taint",
@@ -46,12 +45,12 @@ private class StringSummaries extends SummaryModelCsv {
4645
";StringProtocol;true;cString(using:);;;Argument[-1];ReturnValue;taint",
4746
";StringProtocol;true;capitalized(with:);;;Argument[-1];ReturnValue;taint",
4847
";StringProtocol;true;completePath(into:caseSensitive:matchesInto:filterTypes:);;;Argument[-1];Argument[0].OptionalSome.CollectionElement;taint",
49-
";StringProtocol;true;completePath(into:caseSensitive:matchesInto:filterTypes:);;;Argument[-1];Argument[2].OptionalSome.CollectionElement.ArrayElement;taint",
48+
";StringProtocol;true;completePath(into:caseSensitive:matchesInto:filterTypes:);;;Argument[-1];Argument[2].OptionalSome.CollectionElement.CollectionElement;taint",
5049
";StringProtocol;true;components(separatedBy:);;;Argument[-1];ReturnValue;taint",
5150
";StringProtocol;true;data(using:allowLossyConversion:);;;Argument[-1];ReturnValue;taint",
5251
";StringProtocol;true;folding(options:locale:);;;Argument[-1];ReturnValue;taint",
53-
";StringProtocol;true;getBytes(_:maxLength:usedLength:encoding:options:range:remaining:);;;Argument[-1];Argument[0].ArrayElement;taint",
54-
";StringProtocol;true;getCString(_:maxLength:encoding:);;;Argument[-1];Argument[0].ArrayElement;taint",
52+
";StringProtocol;true;getBytes(_:maxLength:usedLength:encoding:options:range:remaining:);;;Argument[-1];Argument[0].CollectionElement;taint",
53+
";StringProtocol;true;getCString(_:maxLength:encoding:);;;Argument[-1];Argument[0].CollectionElement;taint",
5554
";StringProtocol;true;lowercased();;;Argument[-1];ReturnValue;taint",
5655
";StringProtocol;true;lowercased(with:);;;Argument[-1];ReturnValue;taint",
5756
";StringProtocol;true;padding(toLength:withPad:startingAt:);;;Argument[-1];ReturnValue;taint",
@@ -74,20 +73,18 @@ private class StringSummaries extends SummaryModelCsv {
7473
";String;true;init(repeating:count:);;;Argument[0];ReturnValue;taint",
7574
";String;true;init(data:encoding:);;;Argument[0];ReturnValue.OptionalSome;taint",
7675
";String;true;init(validatingUTF8:);;;Argument[0];ReturnValue.OptionalSome;taint",
77-
";String;true;init(validatingUTF8:);;;Argument[0].ArrayElement;ReturnValue.OptionalSome;taint",
7876
";String;true;init(validatingUTF8:);;;Argument[0].CollectionElement;ReturnValue.OptionalSome;taint",
7977
";String;true;init(utf16CodeUnits:count:);;;Argument[0].CollectionElement;ReturnValue;taint",
8078
";String;true;init(utf16CodeUnitsNoCopy:count:freeWhenDone:);;;Argument[0].CollectionElement;ReturnValue;taint",
8179
";String;true;init(format:_:);;;Argument[0];ReturnValue;taint",
82-
";String;true;init(format:_:);;;Argument[1].ArrayElement;ReturnValue;taint",
80+
";String;true;init(format:_:);;;Argument[1].CollectionElement;ReturnValue;taint",
8381
";String;true;init(format:arguments:);;;Argument[0];ReturnValue;taint",
84-
";String;true;init(format:arguments:);;;Argument[1].ArrayElement;ReturnValue;taint",
82+
";String;true;init(format:arguments:);;;Argument[1].CollectionElement;ReturnValue;taint",
8583
";String;true;init(format:locale:_:);;;Argument[0];ReturnValue;taint",
86-
";String;true;init(format:locale:_:);;;Argument[2].ArrayElement;ReturnValue;taint",
84+
";String;true;init(format:locale:_:);;;Argument[2].CollectionElement;ReturnValue;taint",
8785
";String;true;init(format:locale:arguments:);;;Argument[0];ReturnValue;taint",
88-
";String;true;init(format:locale:arguments:);;;Argument[2].ArrayElement;ReturnValue;taint",
86+
";String;true;init(format:locale:arguments:);;;Argument[2].CollectionElement;ReturnValue;taint",
8987
";String;true;init(_:radix:uppercase:);;;Argument[0];ReturnValue;taint",
90-
";String;true;init(bytes:encoding:);;;Argument[0].ArrayElement;ReturnValue.OptionalSome;taint",
9188
";String;true;init(bytes:encoding:);;;Argument[0].CollectionElement;ReturnValue.OptionalSome;taint",
9289
";String;true;init(bytesNoCopy:length:encoding:freeWhenDone:);;;Argument[0].CollectionElement;ReturnValue.OptionalSome;taint",
9390
";String;true;init(describing:);;;Argument[0];ReturnValue;taint",
@@ -104,20 +101,16 @@ private class StringSummaries extends SummaryModelCsv {
104101
";String;true;init(unicodeScalarLiteral:);;;Argument[0];ReturnValue;taint",
105102
";String;true;init(extendedGraphemeClusterLiteral:);;;Argument[0];ReturnValue;taint",
106103
";String;true;init(cString:encoding:);;;Argument[0];ReturnValue.OptionalSome;taint",
107-
";String;true;init(cString:encoding:);;;Argument[0].ArrayElement;ReturnValue.OptionalSome;taint",
108104
";String;true;init(cString:encoding:);;;Argument[0].CollectionElement;ReturnValue.OptionalSome;taint",
109105
";String;true;init(platformString:);;;Argument[0];ReturnValue;taint",
110-
";String;true;init(platformString:);;;Argument[0].ArrayElement;ReturnValue;taint",
111106
";String;true;init(platformString:);;;Argument[0].CollectionElement;ReturnValue;taint",
112107
";String;true;init(utf8String:);;;Argument[0];ReturnValue.OptionalSome;taint",
113-
";String;true;init(utf8String:);;;Argument[0].ArrayElement;ReturnValue.OptionalSome;taint",
114108
";String;true;init(utf8String:);;;Argument[0].CollectionElement;ReturnValue.OptionalSome;taint",
115109
";String;true;init(validating:);;;Argument[0];ReturnValue.OptionalSome;taint",
116110
";String;true;init(validatingPlatformString:);;;Argument[0];ReturnValue.OptionalSome;taint",
117-
";String;true;init(validatingPlatformString:);;;Argument[0].ArrayElement;ReturnValue.OptionalSome;taint",
118111
";String;true;init(validatingPlatformString:);;;Argument[0].CollectionElement;ReturnValue.OptionalSome;taint",
119112
";String;true;localizedStringWithFormat(_:_:);;;Argument[0];ReturnValue;taint",
120-
";String;true;localizedStringWithFormat(_:_:);;;Argument[1].ArrayContent;ReturnValue;taint",
113+
";String;true;localizedStringWithFormat(_:_:);;;Argument[1].CollectionElement;ReturnValue;taint",
121114
";String;true;write(_:);;;Argument[0];Argument[-1];taint",
122115
";String;true;write(to:);;;Argument[-1];Argument[0];taint",
123116
";String;true;insert(contentsOf:at:);;;Argument[0];Argument[-1];taint",

0 commit comments

Comments
 (0)