@@ -113,7 +113,6 @@ private class StringSummaries extends SummaryModelCsv {
113113 ";String;true;localizedStringWithFormat(_:_:);;;Argument[0];ReturnValue;taint" ,
114114 ";String;true;localizedStringWithFormat(_:_:);;;Argument[1].CollectionElement;ReturnValue;taint" ,
115115 ";String;true;insert(contentsOf:at:);;;Argument[0];Argument[-1];taint" ,
116- ";String;true;replaceSubrange(_:with:);;;Argument[1];Argument[-1];taint" ,
117116 ";String;true;max();;;Argument[-1];ReturnValue;taint" ,
118117 ";String;true;max(by:);;;Argument[-1];ReturnValue;taint" ,
119118 ";String;true;min();;;Argument[-1];ReturnValue;taint" ,
@@ -127,6 +126,9 @@ private class StringSummaries extends SummaryModelCsv {
127126 ";String;true;decodeCString(_:as:repairingInvalidCodeUnits:);;;Argument[0];ReturnValue.TupleElement[0];taint" ,
128127 ";String;true;decodeCString(_:as:repairingInvalidCodeUnits:);;;Argument[0].CollectionElement;ReturnValue.TupleElement[0];taint" ,
129128 ";LosslessStringConvertible;true;init(_:);;;Argument[0];ReturnValue;taint" ,
129+ ";Substring;true;withUTF8(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint" ,
130+ ";Substring;true;withUTF8(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1];taint" ,
131+ ";Substring;true;withUTF8(_:);;;Argument[0].ReturnValue;ReturnValue;value" ,
130132 ]
131133 }
132134}
@@ -139,23 +141,26 @@ private class StringFieldsInheritTaint extends TaintInheritingContent,
139141 DataFlow:: Content:: FieldContent
140142{
141143 StringFieldsInheritTaint ( ) {
142- this .getField ( )
143- .hasQualifiedName ( [ "String" , "StringProtocol" ] ,
144+ exists ( FieldDecl fieldDecl , Decl declaringDecl , TypeDecl namedTypeDecl |
145+ (
146+ namedTypeDecl .getFullName ( ) = [ "String" , "StringProtocol" ] and
147+ fieldDecl .getName ( ) =
144148 [
145149 "unicodeScalars" , "utf8" , "utf16" , "lazy" , "utf8CString" , "dataValue" ,
146150 "identifierValue" , "capitalized" , "localizedCapitalized" , "localizedLowercase" ,
147151 "localizedUppercase" , "decomposedStringWithCanonicalMapping" ,
148152 "decomposedStringWithCompatibilityMapping" , "precomposedStringWithCanonicalMapping" ,
149153 "precomposedStringWithCompatibilityMapping" , "removingPercentEncoding"
150- ] )
151- or
152- exists ( FieldDecl fieldDecl , Decl declaringDecl , TypeDecl namedTypeDecl |
153- (
154+ ]
155+ or
154156 namedTypeDecl .getFullName ( ) = "CustomStringConvertible" and
155157 fieldDecl .getName ( ) = "description"
156158 or
157159 namedTypeDecl .getFullName ( ) = "CustomDebugStringConvertible" and
158160 fieldDecl .getName ( ) = "debugDescription"
161+ or
162+ namedTypeDecl .getFullName ( ) = "Substring" and
163+ fieldDecl .getName ( ) = "base"
159164 ) and
160165 declaringDecl .getAMember ( ) = fieldDecl and
161166 declaringDecl .asNominalTypeDecl ( ) = namedTypeDecl .getADerivedTypeDecl * ( ) and
0 commit comments