@@ -56,46 +56,36 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
5656 StringLengthConflationConfiguration ( ) { this = "StringLengthConflationConfiguration" }
5757
5858 override predicate isSource ( DataFlow:: Node node , string flowstate ) {
59- // result of a call to `String.count`
60- exists ( MemberRefExpr member |
61- member .getBase ( ) .getType ( ) .( NominalType ) .getABaseType * ( ) .getName ( ) = "String" and
62- member .getMember ( ) .( VarDecl ) .getName ( ) = "count" and
59+ exists ( MemberRefExpr member , string className , string varName |
60+ member .getBase ( ) .getType ( ) .( NominalType ) .getABaseType * ( ) .getName ( ) = className and
61+ member .getMember ( ) .( VarDecl ) .getName ( ) = varName and
6362 node .asExpr ( ) = member and
64- flowstate = "String"
65- )
66- or
67- // result of a call to `NSString.length`
68- exists ( MemberRefExpr member |
69- member .getBase ( ) .getType ( ) .( NominalType ) .getABaseType * ( ) .getName ( ) =
70- [ "NSString" , "NSMutableString" ] and
71- member .getMember ( ) .( VarDecl ) .getName ( ) = "length" and
72- node .asExpr ( ) = member and
73- flowstate = "NSString"
74- )
75- or
76- // result of a call to `String.utf8.count`
77- exists ( MemberRefExpr member |
78- member .getBase ( ) .getType ( ) .( NominalType ) .getABaseType * ( ) .getName ( ) = "String.UTF8View" and
79- member .getMember ( ) .( VarDecl ) .getName ( ) = "count" and
80- node .asExpr ( ) = member and
81- flowstate = "String.utf8"
82- )
83- or
84- // result of a call to `String.utf16.count`
85- exists ( MemberRefExpr member |
86- member .getBase ( ) .getType ( ) .( NominalType ) .getABaseType * ( ) .getName ( ) = "String.UTF16View" and
87- member .getMember ( ) .( VarDecl ) .getName ( ) = "count" and
88- node .asExpr ( ) = member and
89- flowstate = "String.utf16"
90- )
91- or
92- // result of a call to `String.unicodeScalars.count`
93- exists ( MemberRefExpr member |
94- member .getBase ( ) .getType ( ) .( NominalType ) .getABaseType * ( ) .getName ( ) =
95- "String.UnicodeScalarView" and
96- member .getMember ( ) .( VarDecl ) .getName ( ) = "count" and
97- node .asExpr ( ) = member and
98- flowstate = "String.unicodeScalars"
63+ (
64+ // result of a call to `String.count`
65+ className = "String" and
66+ varName = "count" and
67+ flowstate = "String"
68+ or
69+ // result of a call to `NSString.length`
70+ className = [ "NSString" , "NSMutableString" ] and
71+ varName = "length" and
72+ flowstate = "NSString"
73+ or
74+ // result of a call to `String.utf8.count`
75+ className = "String.UTF8View" and
76+ varName = "count" and
77+ flowstate = "String.utf8"
78+ or
79+ // result of a call to `String.utf16.count`
80+ className = "String.UTF16View" and
81+ varName = "count" and
82+ flowstate = "String.utf16"
83+ or
84+ // result of a call to `String.unicodeScalars.count`
85+ className = "String.UnicodeScalarView" and
86+ varName = "count" and
87+ flowstate = "String.unicodeScalars"
88+ )
9989 )
10090 }
10191
0 commit comments