mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
JS: address comments
This commit is contained in:
@@ -7,3 +7,4 @@
|
||||
| tst.js:39:10:39:49 | x.lastI ... .length | This suffix check is missing a length comparison to correctly handle lastIndexOf returning -1. |
|
||||
| tst.js:55:32:55:71 | x.index ... gth - 1 | This suffix check is missing a length comparison to correctly handle indexOf returning -1. |
|
||||
| tst.js:67:32:67:71 | x.index ... gth - 1 | This suffix check is missing a length comparison to correctly handle indexOf returning -1. |
|
||||
| tst.js:76:25:76:57 | index = ... gth - 1 | This suffix check is missing a length comparison to correctly handle indexOf returning -1. |
|
||||
|
||||
@@ -70,3 +70,8 @@ function indexOfCheckBad(x, y) {
|
||||
function endsWithSlash(x) {
|
||||
return x.indexOf("/") === x.length - 1; // OK - even though it also matches the empty string
|
||||
}
|
||||
|
||||
function withIndexOfCheckBad(x, y) {
|
||||
let index = x.indexOf(y);
|
||||
return index !== 0 && index === x.length - y.length - 1; // NOT OK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user