Sanitizers/heap_buffer_overflow/heap_buffer_overflow_case.cpp (7 lines of code) (raw):

int main(int argc, char **argv) { int *array = new int[100]; array[0] = 0; int res = array[argc + 100]; // BOOM delete [] array; return res; }