Skip to content

Commit 44f4ff1

Browse files
committed
Swift: accept regression
1 parent ecb5708 commit 44f4ff1

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

swift/ql/test/query-tests/Security/CWE-135/StringLengthConflation.expected

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ edges
22
| StringLengthConflation2.swift:35:36:35:38 | .count : | StringLengthConflation2.swift:35:36:35:46 | ... .-(_:_:) ... |
33
| StringLengthConflation2.swift:37:34:37:36 | .count : | StringLengthConflation2.swift:37:34:37:44 | ... .-(_:_:) ... |
44
| StringLengthConflation.swift:36:30:36:37 | len : | StringLengthConflation.swift:36:93:36:93 | len |
5-
| StringLengthConflation.swift:60:47:60:50 | .length : | StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... |
65
| StringLengthConflation.swift:66:33:66:36 | .length : | StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... |
76
| StringLengthConflation.swift:72:33:72:35 | .count : | StringLengthConflation.swift:36:30:36:37 | len : |
87
| StringLengthConflation.swift:96:28:96:31 | .length : | StringLengthConflation.swift:96:28:96:40 | ... .-(_:_:) ... |
@@ -19,7 +18,6 @@ edges
1918
| StringLengthConflation.swift:138:36:138:38 | .count : | StringLengthConflation.swift:138:36:138:46 | ... .-(_:_:) ... |
2019
| StringLengthConflation.swift:144:28:144:30 | .count : | StringLengthConflation.swift:144:28:144:38 | ... .-(_:_:) ... |
2120
| file://:0:0:0:0 | .length : | StringLengthConflation.swift:53:43:53:46 | .length |
22-
| file://:0:0:0:0 | .length : | StringLengthConflation.swift:60:47:60:50 | .length : |
2321
| file://:0:0:0:0 | .length : | StringLengthConflation.swift:66:33:66:36 | .length : |
2422
| file://:0:0:0:0 | .length : | StringLengthConflation.swift:96:28:96:31 | .length : |
2523
| file://:0:0:0:0 | .length : | StringLengthConflation.swift:100:27:100:30 | .length : |
@@ -38,8 +36,6 @@ nodes
3836
| StringLengthConflation.swift:54:43:54:50 | .count | semmle.label | .count |
3937
| StringLengthConflation.swift:55:43:55:51 | .count | semmle.label | .count |
4038
| StringLengthConflation.swift:56:43:56:60 | .count | semmle.label | .count |
41-
| StringLengthConflation.swift:60:47:60:50 | .length : | semmle.label | .length : |
42-
| StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | semmle.label | ... ./(_:_:) ... |
4339
| StringLengthConflation.swift:66:33:66:36 | .length : | semmle.label | .length : |
4440
| StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | semmle.label | ... ./(_:_:) ... |
4541
| StringLengthConflation.swift:72:33:72:35 | .count | semmle.label | .count |
@@ -84,8 +80,6 @@ subpaths
8480
| StringLengthConflation.swift:54:43:54:50 | .count | StringLengthConflation.swift:54:43:54:50 | .count | StringLengthConflation.swift:54:43:54:50 | .count | This String.utf8 length is used in a String, but it may not be equivalent. |
8581
| StringLengthConflation.swift:55:43:55:51 | .count | StringLengthConflation.swift:55:43:55:51 | .count | StringLengthConflation.swift:55:43:55:51 | .count | This String.utf16 length is used in a String, but it may not be equivalent. |
8682
| StringLengthConflation.swift:56:43:56:60 | .count | StringLengthConflation.swift:56:43:56:60 | .count | StringLengthConflation.swift:56:43:56:60 | .count | This String.unicodeScalars length is used in a String, but it may not be equivalent. |
87-
| StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | StringLengthConflation.swift:60:47:60:50 | .length : | StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. |
88-
| StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | file://:0:0:0:0 | .length : | StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. |
8983
| StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | StringLengthConflation.swift:66:33:66:36 | .length : | StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. |
9084
| StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | file://:0:0:0:0 | .length : | StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. |
9185
| StringLengthConflation.swift:72:33:72:35 | .count | StringLengthConflation.swift:72:33:72:35 | .count | StringLengthConflation.swift:72:33:72:35 | .count | This String length is used in an NSString, but it may not be equivalent. |

swift/ql/test/query-tests/Security/CWE-135/StringLengthConflation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func test(s: String) {
5757
print("String.Index '\(ix1.encodedOffset)' / '\(ix2.encodedOffset)' '\(ix3.encodedOffset)' '\(ix4.encodedOffset)' '\(ix5.encodedOffset)'")
5858

5959
let ix6 = s.index(s.startIndex, offsetBy: s.count / 2) // GOOD
60-
let ix7 = s.index(s.startIndex, offsetBy: ns.length / 2) // BAD: NSString length used in String.Index
60+
let ix7 = s.index(s.startIndex, offsetBy: ns.length / 2) // BAD: NSString length used in String.Index [NOT DETECTED]
6161
print("index '\(ix6.encodedOffset)' / '\(ix7.encodedOffset)'")
6262

6363
var ix8 = s.startIndex

0 commit comments

Comments
 (0)