...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
Key here (explains table format and definitions)
Taxonomy | Taxonomy item | Relationship |
---|---|---|
ISO/IEC TR 24772:2013 | Arithmetic Wrap-Around Error [FIF] | Prior to 2018-01-12: CERT: Unspecified Relationship |
ISO/IEC TR 24772:2013 | Unchecked Array Indexing [XYZ] | Prior to 2018-01-12: CERT: Unspecified Relationship |
ISO/IEC TS 17961 | Forming or using out-of-bounds pointers or array subscripts [invptr] | Prior to 2018-01-12: CERT: Unspecified Relationship |
CWE 2.11MITRE CWE | CWE-119, Improper Restriction of Operations within the Bounds of a Memory BufferCWE | 2017-05-18: CERT: Rule subset of CWE |
CWE 2.11122, Heap-based Buffer Overflow | CWE-123, Write-what-where Condition | 2017-05-18: CERT: Partial overlap |
CWE 2.11 | CWE-125, Out-of-bounds ReadCWE-129, Improper Validation of Array Index CWE-788, Access of Memory Location after End of Buffer | 2017-05-18: CERT: Partial overlap |
MISRA C:2012 | Rule 18.1 (required) | Prior to 2018-01-12: CERT: Unspecified Relationship |
CERT-CWE Mapping Notes
Key here for mapping notes
CWE-119 and ARR30-C
Independent( ARR30-C, ARR38-C, ARR32-C, INT30-C, INT31-C, EXP39-C, EXP33-C, FIO37-C) STR31-C = Subset( Union( ARR30-C, ARR38-C)) STR32-C = Subset( ARR38-C)
CWE-119 = Union( ARR30-C, ARR38-C) Intersection( ARR30-C, ARR38-C) = Ø
CWE-394 and ARR30-C
Intersection( ARR30-C, CWE-394) = Ø
CWE-394 deals with potentially-invalid function return values. Which may be used as an (invalid) array index, but validating the return value is a separate operation.
CWE-125 and ARR30-C
Independent( ARR30-C, ARR38-C, EXP39-C, INT30-C) STR31-C = Subset( Union( ARR30-C, ARR38-C)) STR32-C = Subset( ARR38-C)
CWE-125 = Subset( CWE-119) = Union( ARR30-C, ARR38-C) Intersection( ARR30-C, CWE-125) =
- Reading from an out-of-bounds array index, or off the end of an array
ARR30-C – CWE-125 =
- Writing to an out-of-bounds array index, or off the end of an array
CWE-125 – ARR30-C =
- Reading beyond a non-array buffer
- Using a library function to achieve an out-of-bounds read.
CWE-123 and ARR30-C
Independent(ARR30-C, ARR38-C) STR31-C = Subset( Union( ARR30-C, ARR38-C)) STR32-C = Subset( ARR38-C)
Intersection( CWE-123, ARR30-C) =
- Write of arbitrary value to arbitrary (probably invalid) array index
ARR30-C – CWE-123 =
- Read of value from arbitrary (probably invalid) array index
- Construction of invalid index (pointer arithmetic)
CWE-123 – ARR30-C =
- Arbitrary writes that do not involve directly constructing an invalid array index
CWE-129 and ARR30-C
Independent( ARR30-C, ARR32-C, INT31-C, INT32-C)
ARR30-C = Union( CWE-129, list), where list =
- Dereferencing an out-of-bounds array index, where index is a trusted value
- Forming an out-of-bounds array index, without dereferencing it, whether or not index is a trusted value. (This excludes the array’s TOOFAR index, which is one past the final element; this behavior is well-defined in C11.)
CWE-120 and ARR30-C
See CWE-120 and MEM35-C
CWE-122 and ARR30-C
Intersection( ARR30-C, CWE-122) = Ø
CWE-122 specifically addresses buffer overflows on the heap operations, which occur in the context of string-copying. ARR30 specifically addresses improper creation or references of array indices. Which might happen as part of a heap buffer overflow, but is on a lower programming level.
CWE-20 and ARR30-C
See CWE-20 and ERR34-C
CWE-687 and ARR30-C
Intersection( CWE-687, ARR30-C) = Ø
ARR30-C is about invalid array indices which are created through pointer arithmetic, and dereferenced through an operator (* or []). Neither involve function calls, thus CWE-687 does not apply.
CWE-786 and ARR30-C
ARR30-C = Union( CWE-786, list) where list =
- Access of memory location after end of buffer
- Construction of invalid arry reference (pointer). This does not include an out-of-bounds array index (an integer).
CWE-789 and ARR30-C
Intersection( CWE-789, ARR30-C) = Ø
CWE-789 is about allocating memory, not array subscripting
Bibliography
[Finlay 2003] | |
[Microsoft 2003] | |
[Pethia 2003] | |
[Seacord 2013b] | Chapter 1, "Running with Scissors" |
[Viega 2005] | Section 5.2.13, "Unchecked Array Indexing" |
[xorl 2009 ] | "CVE-2008-1517: Apple Mac OS X (XNU) Missing Array Index Validation" |
...