mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
JS: fix false positives for splice with conditional index decrement
This commit is contained in:
@@ -2,5 +2,4 @@
|
||||
| tst.js:13:29:13:46 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:24:9:24:26 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:128:11:128:33 | pending ... e(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:136:32:136:47 | toc.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:143:10:143:25 | toc.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:153:11:153:26 | toc.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
|
||||
@@ -133,16 +133,26 @@ function withTryCatch(pendingCSS) {
|
||||
|
||||
function andOperand(toc) {
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--; // $ SPURIOUS:Alert
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--;
|
||||
}
|
||||
}
|
||||
|
||||
function ifStatement(toc) {
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
if(toc[i].ignoreSubHeading){
|
||||
if(toc.splice(i, 1)){ // $ SPURIOUS:Alert
|
||||
if(toc.splice(i, 1)){
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ifStatement2(toc) {
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
if(toc[i].ignoreSubHeading){
|
||||
if(!toc.splice(i, 1)){ // $Alert
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user