|
From: Mike M. <mi...@su...> - 2006-06-04 08:49:12
|
Meir, that's what I thought at first, too. What's interesting though, is the function ptsname() is supposed to return a pointer to a statically allocated buffer, or NULL on failure. It's hard for me to imagine a possible case where that function would return a bad pointer. I even opened up the code for glibc-2.3.5 to see how it's implemented and it's a simple one liner (call to ptsname_r). Thanks, Mike On 6/4/06, Yeshurun, Meir <mei...@in...> wrote: > > Before the experts answer you, it sounds to me like maybe you're passing > around some un-initialized value which happens to have the right value > (or just a "better" value) when running under Valgrind. > > Thanks, > Meir > > -----Original Message----- > From: val...@li... > [mailto:val...@li...] On Behalf Of Mike > Mueller > Sent: Sunday, June 04, 2006 6:29 AM > To: val...@li... > Cc: Bob Rossi > Subject: [Valgrind-users] Segfault not caught by valgrind > > I have a weird situation. I'll try to describe it as completely as > possible: > > I have a program that does not crash, and when run through valgrind, 0 > errors are reported. Someone else patched it to get it to recompile > on FreeBSD by moving a single include (sys/types.h) from the bottom to > the top of the includes list. Now the program segfaults on my AMD64 > computer (but not on any other computers, as far as I can tell, > including x86, ppc). > > Now, I debug it in gdb and I find the line where it's crashing. It's > a call to ptsname that's returning garbage instead of a valid pointer > to a string (or NULL, the failure case). Can't figure out why ptsname > is returning garbage unless there's a weird memory corruption or the > system library is buggy on amd64. > > However, when I run the program through valgrind (using the memcheck > tool), it does NOT crash and valgrind reports 0 errors. > > One last bit, if I call ptsname_r instead of ptsname, there is no > segfault. > > Have you ever seen anything like this? > > Thanks! > Mike > > > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |