Julian Seward 31b741dc9b Merge the Ptrcheck tool from branches/PTRCHECK r8619.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8620
2008-09-18 14:43:05 +00:00

24 lines
460 B
C

#include <stdlib.h>
#include <assert.h>
// This is an example of an error found by Annelid, but not found by
// Memcheck -- because the wild read goes past the redzones of the pointer's
// block.
//
// Nb: for Memcheck to not spot this, relies on it putting the 2nd block in
// memory after the 1st block.
int main ( void )
{
char c;
char *c0, *c1;
c0 = malloc(10000);
c1 = malloc(10000);
assert(c0 && c1);
c = c0[15000];
return 0;
}