blob: 366c78ba36fea253c3e00dfab8d8aff5af668b1d [file] [log] [blame]
sewardj024598e2008-09-18 14:43:05 +00001#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
11int main ( void )
12{
bartf976f6c2011-04-03 17:42:19 +000013 char c __attribute__((unused));
sewardj024598e2008-09-18 14:43:05 +000014 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}