mirror of
https://github.com/github/codeql.git
synced 2026-04-22 15:25:18 +02:00
add fallback if I can't easily determine the variable
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
| Test.java:68:5:68:25 | ...+=... | Implicit cast of source $@ to narrower destination type int. | Test.java:64:4:64:13 | int i | type long |
|
||||
| Test.java:87:4:87:9 | ...+=... | Implicit cast of source $@ to narrower destination type int. | Test.java:81:4:81:13 | int i | type long |
|
||||
| Test.java:289:5:289:30 | ...+=... | Implicit cast of source $@ to narrower destination type int. | Test.java:285:4:285:27 | int[] arr | type long |
|
||||
| Test.java:68:5:68:25 | ...+=... | Implicit cast of $@ to narrower destination type int. | Test.java:64:4:64:13 | int i | source type long |
|
||||
| Test.java:87:4:87:9 | ...+=... | Implicit cast of $@ to narrower destination type int. | Test.java:81:4:81:13 | int i | source type long |
|
||||
| Test.java:289:5:289:30 | ...+=... | Implicit cast of $@ to narrower destination type int. | Test.java:285:4:285:27 | int[] arr | source type long |
|
||||
| Test.java:293:7:293:44 | ...+=... | Implicit cast of $@ to narrower destination type int. | Test.java:293:7:293:24 | ...[...] | source type long |
|
||||
|
||||
@@ -288,6 +288,9 @@ class Test {
|
||||
// which will result in overflows if it is large
|
||||
arr[2] += getLargeNumber();
|
||||
}
|
||||
|
||||
// BAD.
|
||||
getAnIntArray()[0] += getLargeNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,6 +298,10 @@ class Test {
|
||||
return Long.MAX_VALUE / 2;
|
||||
}
|
||||
|
||||
public static int[] getAnIntArray() {
|
||||
return new int[10];
|
||||
}
|
||||
|
||||
public static boolean properlyBounded(int i) {
|
||||
return i < Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user