Java: FP in java/index-out-of-bounds when index known to be less than the length of the array
Đang mở
false-positive
Java
- Ngôn ngữ chính
- CodeQL
- Star
- 10.1k
- Fork
- 2.1k
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 141
Mô tả
See: https://discuss.lgtm.com/t/java-false-positives/1787/2
```java
int x = ++i;
int y = ++i;
if (y < sb.length) {
byte[] hex = {sb[x], sb[y]};
^^^^^ -- flagged as alert
```
We know that (modulo overflow):
* `x` = `y - 1` --> `x` < `y`
* `y` < `sb.length`
Example: https://lgtm.com/projects/g/apache/accumulo/snapshot/b672a845ed56e9fd521ab85462cb6c45baa9abad/files/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java?sort=name&dir=ASC&mode=heatmap#xb5a588dd1daff67e:1
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.