@@ -21,7 +21,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
21
21
// result of a call to to `String.count`
22
22
exists ( MemberRefExpr member |
23
23
member .getBaseExpr ( ) .getType ( ) .getName ( ) = "String" and
24
- member .getMember ( ) .toString ( ) = "count" and // TODO: use of toString
24
+ member .getMember ( ) .( VarDecl ) . getName ( ) = "count" and
25
25
node .asExpr ( ) = member and
26
26
flowstate = "String"
27
27
)
@@ -36,28 +36,39 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
36
36
(
37
37
// `NSRange.init`
38
38
className = "NSRange" and
39
- methodName = "init" and
39
+ methodName = "init(location:length:) " and
40
40
paramName = [ "location" , "length" ]
41
41
or
42
42
// `NSString.character`
43
43
className = [ "NSString" , "NSMutableString" ] and
44
- methodName = "character" and
44
+ methodName = "character(at:) " and
45
45
paramName = "at"
46
46
or
47
47
// `NSString.character`
48
48
className = [ "NSString" , "NSMutableString" ] and
49
- methodName = "substring" and
50
- paramName = [ "from" , "to" ]
49
+ methodName = "substring(from:)" and
50
+ paramName = "from"
51
+ or
52
+ // `NSString.character`
53
+ className = [ "NSString" , "NSMutableString" ] and
54
+ methodName = "substring(to:)" and
55
+ paramName = "to"
51
56
or
52
57
// `NSMutableString.insert`
53
58
className = "NSMutableString" and
54
- methodName = "insert" and
59
+ methodName = "insert(_:at:) " and
55
60
paramName = "at"
56
61
) and
57
- c .toString ( ) = className and // TODO: use of toString
62
+ c .getName ( ) = className and
58
63
c .getAMember ( ) = f and // TODO: will this even work if its defined in a parent class?
59
64
call .getFunction ( ) .( ApplyExpr ) .getFunction ( ) .( DeclRefExpr ) .getDecl ( ) = f and
60
- call .getFunction ( ) .( ApplyExpr ) .getFunction ( ) .toString ( ) = methodName and // TODO: use of toString
65
+ call .getFunction ( )
66
+ .( ApplyExpr )
67
+ .getFunction ( )
68
+ .( DeclRefExpr )
69
+ .getDecl ( )
70
+ .( AbstractFunctionDecl )
71
+ .getName ( ) = methodName and
61
72
f .getParam ( arg ) .getName ( ) = paramName and
62
73
call .getArgument ( arg ) .getExpr ( ) = node .asExpr ( ) and
63
74
flowstate = "String" // `String` length flowing into `NSString`
0 commit comments