Skip to content

Commit 0bc24b8

Browse files
committed
Swift: Model replaceSubrange more generally.
1 parent c6f2a29 commit 0bc24b8

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ private class CollectionSummaries extends SummaryModelCsv {
3636
";RangeReplaceableCollection;true;removeFirst();;;Argument[-1];ReturnValue;taint",
3737
";RangeReplaceableCollection;true;removeLast();;;Argument[-1];ReturnValue;taint",
3838
";RangeReplaceableCollection;true;insert(_:at:);;;Argument[0];Argument[-1];taint",
39+
";RangeReplaceableCollection;true;replaceSubrange(_:with:);;;Argument[1];Argument[-1];taint",
40+
";RangeReplaceableCollection;true;replaceSubrange(_:with:);;;Argument[1].CollectionElement;Argument[-1].CollectionElement;value",
3941
";BidirectionalCollection;true;joined(separator:);;;Argument[-1..0];ReturnValue;taint",
4042
";BidirectionalCollection;true;last(where:);;;Argument[-1];ReturnValue;taint",
4143
";BidirectionalCollection;true;popLast();;;Argument[-1];ReturnValue;taint",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ private class StringSummaries extends SummaryModelCsv {
114114
";String;true;write(_:);;;Argument[0];Argument[-1];taint",
115115
";String;true;write(to:);;;Argument[-1];Argument[0];taint",
116116
";String;true;insert(contentsOf:at:);;;Argument[0];Argument[-1];taint",
117-
";String;true;replaceSubrange(_:with:);;;Argument[1];Argument[-1];taint",
118117
";String;true;max();;;Argument[-1];ReturnValue;taint",
119118
";String;true;max(by:);;;Argument[-1];ReturnValue;taint",
120119
";String;true;min();;;Argument[-1];ReturnValue;taint",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,5 +675,5 @@ func testSubstringMembers() {
675675
var sub4 = clean.prefix(10)
676676
sink(arg: sub4)
677677
sub4.replaceSubrange(..<clean.endIndex, with: sub1)
678-
sink(arg: sub4) // $ MISSING: tainted=
678+
sink(arg: sub4) // $ tainted=654
679679
}

0 commit comments

Comments
 (0)