This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Suspicious C++ stringstream crashes, gcc 3.3.3


On Monday 24 May 2004 22:54, Joe Buck wrote:
>
> This sounds like memory corruption.  If you scribble on the heap, a crash
> can result at any later point that accesses the heap, including in
> stringstream.  The fact that adding debug code makes it go away rings this
> bell for me.

Yea, I know. My immediate reaction was the same. But it just kept coming back 
at the same place...

>
> I would recommend the use of some memory-checking tool, for example,
> valgrind if you're on an x86 gnu/linux box.

Good call, but the results back up my initial bug report I think. From 
Valgrind:

==6011== Conditional jump or move depends on uninitialised value(s)
==6011==    at 0x3C07D9A6: std::__pad<char, std::char_traits<char> 
>::_S_pad(std::ios_base&, char, char*, char const*, int, int, bool) 
(in /pkg/gcc.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5.0.5)
==6011==    by 0x3C07DA83: std::num_put<char, std::ostreambuf_iterator<char, 
std::char_traits<char> > >::_M_pad(char, int, std::ios_base&, char*, char 
const*, int&) const 
(in /pkg/gcc.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5.0.5)
==6011==    by 0x3C07EB4F: std::ostreambuf_iterator<char, 
std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, 
std::char_traits<char> > >::_M_convert_int<unsigned 
long>(std::ostreambuf_iterator<char, std::char_traits<char> >, 
std::ios_base&, char, unsigned long) const 
(in /pkg/gcc.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5.0.5)
==6011==    by 0x3C07E53F: std::num_put<char, std::ostreambuf_iterator<char, 
std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, 
std::char_traits<char> >, std::ios_base&, char, unsigned long) const 
(in /pkg/gcc.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5.0.5)

and then a while later the crash

==6011== Process terminating with default action of signal 11 (SIGSEGV): 
dumping core
==6011==  Bad permissions for mapped region at address 0x4FFFF000
==6011==    at 0x3C01D07E: memcpy (mac_replace_strmem.c:297)
==6011==    by 0x3C07D8D3: std::__pad<char, std::char_traits<char> 
>::_S_pad(std::ios_base&, char, char*, char const*, int, int, bool) 
(in /pkg/gcc.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5.0.5)
==6011==    by 0x3C07DA83: std::num_put<char, std::ostreambuf_iterator<char, 
std::char_traits<char> > >::_M_pad(char, int, std::ios_base&, char*, char 
const*, int&) const 
(in /pkg/gcc.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5.0.5)
==6011==    by 0x3C07EB4F: std::ostreambuf_iterator<char, 
std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, 
std::char_traits<char> > >::_M_convert_int<unsigned 
long>(std::ostreambuf_iterator<char, std::char_traits<char> >, 
std::ios_base&, char, unsigned long) const 
(in /pkg/gcc.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5.0.5)

Does this get us any further?

Andrew Walrond


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]