Re: gdb not catching out-of-bounds pointer



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?
.



Relevant Pages

  • Re: gdb not catching out-of-bounds pointer
    ... I don't know if I'm using it correctly, but Valgrind isn't catching ... the out-of-bounds errors: ...     return 0;} ... toe ~ $ valgrind ./blah ...
    (comp.unix.programmer)
  • Re: Baby Born In Bay Area With 12 Functioning Fingers, 12 Toes
    ... This is left over DNA from the nephilim who ... had 6 fingers and toes on each hand and foot. ... A cat who lives a few houses down from us has an extra toe on each paw. ...
    (talk.origins)
  • Re: debate for chief justicat
    ... why did you bite his big toe? ... What punishment did you give him? ... Effurry cat should play. ... When are we votin fur Chief Justicat? ...
    (rec.pets.cats.community)
  • Re: I hurts like hell
    ... I'm scared to take my shoe off and look at it. ... I once broke my little toe whacking it against a book case. ... I would do a cat scan but my cat is having her nap right now. ... I'm not a doctor, but I play one on the internet. ...
    (alt.support.stop-smoking)
  • Re: Coffee beans and rodents?
    ... > Last time I had a cat, it amused me endlessly with tricks like ... > stabbing me in the toe with a claw that it kept especially for that ...
    (alt.coffee)