github / github/codeql

[Java] WildcardTypeAccess.hasNoBound() returns wrong result for array bounds

Đang mở
#4,005 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
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ả

`WildcardTypeAccess.hasNoBound()` returns for wildcards bounded by an array type, that they have no bound.
Example query:
```ql
import java

from WildcardTypeAccess w
where
exists (w.getUpperBound())
and w.hasNoBound()
select w
```
[Query console link](https://lgtm.com/query/1406379471933943968/)

The issue appears to be that this predicate only checks for `TypeAccess` children, however `ArrayTypeAccess` is not a subclass of `TypeAccess`:
https://github.com/github/codeql/blob/595ab442e66a0911f836ae859faebcd3f4f0177d/java/ql/src/semmle/code/java/Expr.qll#L1589-L1590

Maybe it would suffice checking that any child expression at index 0 or 1 exists (or would that also match annotations somehow)?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.