Query module ArrayIndexOutOfBounds

name
Array index out of bounds
description
Accessing an array with an index that is greater than or equal to the length of the array causes an ‘ArrayIndexOutOfBoundsException’.
kind
problem
problem.severity
error
precision
high
id
java/index-out-of-bounds
tags
reliability correctness exceptions

Imports

RangeAnalysis

Provides classes and predicates for range analysis.

RangeUtils

Provides utility predicates for range analysis.

SSA

Provides classes and predicates for SSA representation (Static Single Assignment form).

java

Provides all default Java QL imports.

Predicates

bestArrayAccessBound

Holds if the index expression is less than or equal to the array length plus k, but not necessarily less than or equal to the array length plus k-1.

boundedArrayAccess

Holds if the index expression of aa is less than or equal to the array length plus k.