mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
Merge pull request #372 from aschackmull/java/rangeanalysis-array-phinodes
Approved by yh-semmle
This commit is contained in:
@@ -34,7 +34,7 @@ public class A {
|
||||
}
|
||||
for (int i = 0; i < arr1.length; ) {
|
||||
sum += arr1[i++]; // OK
|
||||
sum += arr1[i++]; // OK - FP
|
||||
sum += arr1[i++]; // OK
|
||||
i += 2;
|
||||
}
|
||||
for (int i = 0; i < arr2.length; ) {
|
||||
@@ -162,4 +162,17 @@ public class A {
|
||||
sum += b[i] + b[i + 1]; // OK
|
||||
}
|
||||
}
|
||||
|
||||
void m13(int n) {
|
||||
int[] a = null;
|
||||
if (n > 0) {
|
||||
a = n > 0 ? new int[3 * n] : null;
|
||||
}
|
||||
int sum;
|
||||
if (a != null) {
|
||||
for (int i = 0; i < a.length; i += 3) {
|
||||
sum += a[i + 2]; // OK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
| A.java:16:14:16:17 | ...[...] | This array access might be out of bounds, as the index might be equal to the array length. |
|
||||
| A.java:23:21:23:28 | ...[...] | This array access might be out of bounds, as the index might be equal to the array length. |
|
||||
| A.java:37:14:37:22 | ...[...] | This array access might be out of bounds, as the index might be equal to the array length. |
|
||||
| A.java:42:14:42:22 | ...[...] | This array access might be out of bounds, as the index might be equal to the array length. |
|
||||
| A.java:46:14:46:22 | ...[...] | This array access might be out of bounds, as the index might be equal to the array length. |
|
||||
| A.java:55:14:55:19 | ...[...] | This array access might be out of bounds, as the index might be equal to the array length. |
|
||||
|
||||
Reference in New Issue
Block a user