Skip to content

Commit 5b52857

Browse files
committed
Swift: Update similar cases.
1 parent c3a8da4 commit 5b52857

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

swift/ql/src/queries/Security/CWE-135/StringLengthConflation.ql

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,39 +58,41 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
5858
override predicate isSource(DataFlow::Node node, string flowstate) {
5959
// result of a call to `String.count`
6060
exists(MemberRefExpr member |
61-
member.getBase().getType().getName() = "String" and
61+
member.getBase().getType().(NominalType).getABaseType*().getName() = "String" and
6262
member.getMember().(VarDecl).getName() = "count" and
6363
node.asExpr() = member and
6464
flowstate = "String"
6565
)
6666
or
6767
// result of a call to `NSString.length`
6868
exists(MemberRefExpr member |
69-
member.getBase().getType().getName() = ["NSString", "NSMutableString"] and
69+
member.getBase().getType().(NominalType).getABaseType*().getName() =
70+
["NSString", "NSMutableString"] and
7071
member.getMember().(VarDecl).getName() = "length" and
7172
node.asExpr() = member and
7273
flowstate = "NSString"
7374
)
7475
or
7576
// result of a call to `String.utf8.count`
7677
exists(MemberRefExpr member |
77-
member.getBase().getType().getName() = "String.UTF8View" and
78+
member.getBase().getType().(NominalType).getABaseType*().getName() = "String.UTF8View" and
7879
member.getMember().(VarDecl).getName() = "count" and
7980
node.asExpr() = member and
8081
flowstate = "String.utf8"
8182
)
8283
or
8384
// result of a call to `String.utf16.count`
8485
exists(MemberRefExpr member |
85-
member.getBase().getType().getName() = "String.UTF16View" and
86+
member.getBase().getType().(NominalType).getABaseType*().getName() = "String.UTF16View" and
8687
member.getMember().(VarDecl).getName() = "count" and
8788
node.asExpr() = member and
8889
flowstate = "String.utf16"
8990
)
9091
or
9192
// result of a call to `String.unicodeScalars.count`
9293
exists(MemberRefExpr member |
93-
member.getBase().getType().getName() = "String.UnicodeScalarView" and
94+
member.getBase().getType().(NominalType).getABaseType*().getName() =
95+
"String.UnicodeScalarView" and
9496
member.getMember().(VarDecl).getName() = "count" and
9597
node.asExpr() = member and
9698
flowstate = "String.unicodeScalars"

0 commit comments

Comments
 (0)