Accessing or writing to memory outside allocated C array bounds.
C arrays do not perform runtime boundary checking. Writing or reading past array dimensions reads adjacent stack or heap memory.
Off-by-one errors in `for` loops (`i <= size` instead of `i < size`), or incorrect index calculations.
1#include <stdio.h>2 3int main() {4 int scores[5] = {10, 20, 30, 40, 50};5 6 // Off-by-one bug: index 5 is out of bounds (valid indices: 0..4)7 for (int i = 0; i <= 5; i++) {8 printf("Score %d: %d\n", i, scores[i]);9 }10 return 0;11}1#include <stdio.h>2 3int main() {4 int scores[5] = {10, 20, 30, 40, 50};5 int count = sizeof(scores) / sizeof(scores[0]);6 7 for (int i = 0; i < count; i++) { // Correct loop boundary check8 printf("Score %d: %d\n", i, scores[i]);9 }10 return 0;11}Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
`scores` has 5 elements (indices 0..4). When `i = 5`, `scores[5]` reads memory past array allocation, returning garbage or corrupting variables.