Re: gdb not catching out-of-bounds pointer
- From: Tomás Ó hÉilidhe <toe@xxxxxxxxxxx>
- Date: Thu, 11 Dec 2008 20:01:17 -0800 (PST)
On Dec 12, 12:06 am, Nate Eldredge <n...@xxxxxxxxxx> wrote:
Otherwise, you need something like valgrind, which effectively
single-steps your program and does bounds checking.
I don't know if I'm using it correctly, but Valgrind isn't catching
the out-of-bounds errors:
toe ~ $ cat blah.c
#include <string.h>
int main(void)
{
char buf1[5];
char buf2[5];
strcpy(buf2, "12345678");
return 0;
}
toe ~ $ gcc -g -o blah blah.c
toe ~ $ valgrind ./blah
==6502== Memcheck, a memory error detector.
==6502== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
al.
==6502== Using LibVEX rev 1854, a library for dynamic binary
translation.
==6502== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==6502== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation
framework.
==6502== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
al.
==6502== For more details, rerun with: -v
==6502==
==6502==
==6502== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from
1)
==6502== malloc/free: in use at exit: 0 bytes in 0 blocks.
==6502== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==6502== For counts of detected errors, rerun with: -v
==6502== All heap blocks were freed -- no leaks are possible.
toe ~ $
Any ideas?
.
- Follow-Ups:
- Re: gdb not catching out-of-bounds pointer
- From: raxit@xxxxxxxxx
- Re: gdb not catching out-of-bounds pointer
- From: David Schwartz
- Re: gdb not catching out-of-bounds pointer
- References:
- gdb not catching out-of-bounds pointer
- From: Tomás Ó hÉilidhe
- Re: gdb not catching out-of-bounds pointer
- From: Nate Eldredge
- gdb not catching out-of-bounds pointer
- Prev by Date: what permissions are needed to let a php script call the "svn update" subversion command?
- Next by Date: Re: what permissions are needed to let a php script call the "svn update" subversion command?
- Previous by thread: Re: gdb not catching out-of-bounds pointer
- Next by thread: Re: gdb not catching out-of-bounds pointer
- Index(es):
Relevant Pages
|