...
UB | Description | Example Code |
---|---|---|
Addition or subtraction of a pointer into, or just beyond, an array object and an integer type produces a result that does not point into, or just beyond, the same array object. | ARR30-C. Do not form or use out of bounds pointers or array subscriptsForming Out-of-Bounds Pointer, | |
Addition or subtraction of a pointer into, or just beyond, an array object and an integer type produces a result that points just beyond the array object and is used as the operand of a unary | Dereferencing Past the End Pointer, ARR30-C. Do not form or use out of bounds pointers or array subscripts Using Past the End Index | |
An array subscript is out of range, even if an object is apparently accessible with the given subscript (as in the lvalue expression | ARR30-C. Do not form or use out of bounds pointers or array subscriptsApparently Accessible Out-of-Range Index | |
An attempt is made to access, or generate a pointer to just past, a flexible array member of a structure when the referenced object provides no elements for that array.ARR30-C. Do not form or use out of bounds pointers or array subscripts |
Anchor | ||||
---|---|---|---|---|
|
...
Noncompliant Code Example (Using Past the End Index)
Similar to the dereferencing-past-the-end-pointer error, the function insert_in_table()
in this noncompliant code example uses an otherwise valid index to attempt to store a value in an element just past the end of an array.
...