Skip to content

Commit 1130d0c

Browse files
committed
JS: add comment about arrays
1 parent 374f7ab commit 1130d0c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

javascript/ql/src/Security/CWE-020/IncorrectSuffixCheck.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ predicate isDerivedFromLength(DataFlow::Node length, DataFlow::Node operand) {
9999
}
100100

101101
/**
102-
* An equality comparison of form `A.indexOf(B) === A.length - B.length` or similar.
102+
* An equality comparison of form `A.indexOf(B) === A.length - B.length` or similar.
103+
*
104+
* We assume A and B are strings, even A and/or B could be also be arrays.
105+
* The comparison with the length rarely occurs for arrays, however.
103106
*/
104107
class UnsafeIndexOfComparison extends EqualityTest {
105108
IndexOfCall indexOf;

0 commit comments

Comments
 (0)