File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
lib/codeql/swift/frameworks/StandardLibrary
test/library-tests/dataflow/taint/libraries Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,9 @@ private class StringSummaries extends SummaryModelCsv {
125
125
";String;true;enumerated();;;Argument[-1];ReturnValue;taint" ,
126
126
";String;true;encode(to:);;;Argument[-1];Argument[0];taint" ,
127
127
";LosslessStringConvertible;true;init(_:);;;Argument[0];ReturnValue;taint" ,
128
+ ";Substring;true;withUTF8(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint" ,
129
+ ";Substring;true;withUTF8(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1];taint" ,
130
+ ";Substring;true;withUTF8(_:);;;Argument[0].ReturnValue;ReturnValue;value" ,
128
131
]
129
132
}
130
133
}
@@ -154,6 +157,9 @@ private class StringFieldsInheritTaint extends TaintInheritingContent,
154
157
or
155
158
namedTypeDecl .getFullName ( ) = "CustomDebugStringConvertible" and
156
159
fieldDecl .getName ( ) = "debugDescription"
160
+ or
161
+ namedTypeDecl .getFullName ( ) = "Substring" and
162
+ fieldDecl .getName ( ) = "base"
157
163
) and
158
164
declaringDecl .getAMember ( ) = fieldDecl and
159
165
declaringDecl .asNominalTypeDecl ( ) = namedTypeDecl .getADerivedTypeDecl * ( ) and
Original file line number Diff line number Diff line change @@ -655,7 +655,7 @@ func testSubstringMembers() {
655
655
656
656
let sub1 = tainted [ ..< tainted. index ( tainted. endIndex, offsetBy: - 5 ) ]
657
657
sink ( arg: sub1) // $ tainted=654
658
- sink ( arg: sub1. base) // $ MISSING: tainted=
658
+ sink ( arg: sub1. base) // $ tainted=654
659
659
sink ( arg: sub1. utf8) // $ tainted=654
660
660
sink ( arg: sub1. capitalized) // $ tainted=654
661
661
sink ( arg: sub1. description) // $ tainted=654
@@ -664,10 +664,10 @@ func testSubstringMembers() {
664
664
sink ( arg: sub2) // $ tainted=654
665
665
let result1 = sub2. withUTF8 ( {
666
666
buffer in
667
- sink ( arg: buffer [ 0 ] ) // $ MISSING: tainted=
667
+ sink ( arg: buffer [ 0 ] ) // $ tainted=654
668
668
return source ( )
669
669
} )
670
- sink ( arg: result1) // $ MISSING: tainted=
670
+ sink ( arg: result1) // $ tainted=668
671
671
672
672
let sub3 = Substring ( sub2. utf8)
673
673
sink ( arg: sub3) // $ tainted=654
You can’t perform that action at this time.
0 commit comments