------- Comment #5 from paolo dot carlini at oracle dot com  2009-03-30 15:58 
-------
Your code triggers undefined behaviour here:

const char* OutBuf = reinterpret_cast<const char*>(OutStream.str().c_str());

because str() returns a temporary string, which then dies, leaving OutBuf
pointing to unallocated memory. Just copy that temporary somewhere, dunno:

std::string outstr = OutStream.str(); 
const char* OutBuf = outstr.c_str();

or something similar.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39569

Reply via email to