1 #include <stdlib.h> 2 #include <assert.h> 3 4 // This is an example of an error found by Annelid, but not found by 5 // Memcheck -- because the wild read goes past the redzones of the pointer's 6 // block. 7 // 8 // Nb: for Memcheck to not spot this, relies on it putting the 2nd block in 9 // memory after the 1st block. 10 11 int main ( void ) 12 { 13 char c; 14 char *c0, *c1; 15 16 c0 = malloc(10000); 17 c1 = malloc(10000); 18 assert(c0 && c1); 19 20 c = c0[15000]; 21 22 return 0; 23 } 24