Swift: Update similar cases.

This commit is contained in:
Geoffrey White
2022-09-02 18:41:03 +01:00
parent c3a8da4570
commit 5b528573ce

View File

@@ -58,7 +58,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
override predicate isSource(DataFlow::Node node, string flowstate) {
// result of a call to `String.count`
exists(MemberRefExpr member |
member.getBase().getType().getName() = "String" and
member.getBase().getType().(NominalType).getABaseType*().getName() = "String" and
member.getMember().(VarDecl).getName() = "count" and
node.asExpr() = member and
flowstate = "String"
@@ -66,7 +66,8 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
or
// result of a call to `NSString.length`
exists(MemberRefExpr member |
member.getBase().getType().getName() = ["NSString", "NSMutableString"] and
member.getBase().getType().(NominalType).getABaseType*().getName() =
["NSString", "NSMutableString"] and
member.getMember().(VarDecl).getName() = "length" and
node.asExpr() = member and
flowstate = "NSString"
@@ -74,7 +75,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
or
// result of a call to `String.utf8.count`
exists(MemberRefExpr member |
member.getBase().getType().getName() = "String.UTF8View" and
member.getBase().getType().(NominalType).getABaseType*().getName() = "String.UTF8View" and
member.getMember().(VarDecl).getName() = "count" and
node.asExpr() = member and
flowstate = "String.utf8"
@@ -82,7 +83,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
or
// result of a call to `String.utf16.count`
exists(MemberRefExpr member |
member.getBase().getType().getName() = "String.UTF16View" and
member.getBase().getType().(NominalType).getABaseType*().getName() = "String.UTF16View" and
member.getMember().(VarDecl).getName() = "count" and
node.asExpr() = member and
flowstate = "String.utf16"
@@ -90,7 +91,8 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
or
// result of a call to `String.unicodeScalars.count`
exists(MemberRefExpr member |
member.getBase().getType().getName() = "String.UnicodeScalarView" and
member.getBase().getType().(NominalType).getABaseType*().getName() =
"String.UnicodeScalarView" and
member.getMember().(VarDecl).getName() = "count" and
node.asExpr() = member and
flowstate = "String.unicodeScalars"