Boost C++ Libraries: Ticket #602: segm. fault during std::string (STLport 5.0.2) serialization https://svn.boost.org/trac10/ticket/602 <pre class="wiki">There is an segmentation fault during STLport5.0.2 std::string object serialization. It is probably caused by new implementation of std::string. Now, one of possible implementation of _String_base class contains members: _M_buffers - union, wich holds dynamic char buffer _M_Finish - pointer to end of string in dynamic buffer In this case it represents our string, as a chain of chars, which is not ended with null separator. For example in my debbuger string "Un." is represented as: +_M_buffers._M_dynamic_buf 0x00378958 "Un.' 'data same as trigger' parameter is not set, 'use as data' cannot be changed.ÍÍÍÍÍÍWhen 'data same as trigger' parameter is not set, 'use as data' cannot be changed.ÍÍÍÍÍÍ`Å 7" char * -_M_finish 0x0037895b "' 'data same as trigger' parameter is not set, 'use as data' cannot be changed.ÍÍÍÍÍÍWhen 'data same as trigger' parameter is not set, 'use as data' cannot be changed.ÍÍÍÍÍÍ`Å 7" char * During serialization, there is used std::copy algorithm, which use template class escape, as an iterator, to iterate through the string. in file: ../boost/archive/iterators/escape.hpp we see function: void increment(){ if(++m_bnext &lt; m_bend){ m_current_value = *m_bnext; return; } ++(this-&gt;base_reference()); m_bnext = NULL; m_bend = NULL; m_current_value = (static_cast&lt;Derived *&gt;(this))-&gt;fill(m_bnext, m_bend); } When iterator points to last char in string, and then is incremented, it points to next char in dynamic buffer _M_buffers._M_dynamic_buf - in our example with string "Un." it points to apostrof character '\''. Then function "fill" modifies "m_bnext" and "m_bend", because of character '\''. In the next step, function "equal" is called, to check if copy algorithm should be stopped or not. bool equal(const this_t &amp; rhs) const { return NULL == m_bnext &amp;&amp; NULL == m_bend &amp;&amp; this-&gt;base_reference() == rhs.base_reference() ; } And because of m_bnext and m_bend are not NULL's, copy algorithm is not stopped and goes on. It leads to segmentation fault. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/602 Trac 1.4.3 Robert Ramey Fri, 14 Apr 2006 04:00:31 GMT <link>https://svn.boost.org/trac10/ticket/602#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/602#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=396141 Thank you for submitting a bug report to BOOST </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Fri, 14 Apr 2006 04:00:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/602#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/602#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=396141 Thank you for finding this. I realize that it's takes significant effort and I appreciated it. I've seen this show up on tests but couldn't get stlport 5.0 working on my system in order to able to track it down. Now I understand the problem from your explanation. I'm not sure yet how to fix it. I'm not sure how long it will take - thanks again. Robert Ramey </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>sf-robot</dc:creator> <pubDate>Sat, 29 Apr 2006 02:20:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/602#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/602#comment:3</guid> <description> <pre class="wiki">Logged In: YES user_id=1312539 This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>sf-robot</dc:creator> <pubDate>Sat, 29 Apr 2006 02:20:22 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/602#comment:4 https://svn.boost.org/trac10/ticket/602#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket