Boost C++ Libraries: Ticket #9855: Corruption in container::string when used with boost::interprocess https://svn.boost.org/trac10/ticket/9855 <p> I have found a rather strange problem in Boost.Container which I can only get to show itself when used from Boost.Interprocess. So the problem may be in either Boost.Container and Boost.Interprocess. </p> <p> I have a vector of strings (in shared memory). When I push back some of these strings one of them ends up missing its null termination (c_str() returns a string which has a garbage character at the end). </p> <p> I have tried to work out what the problem is, and my theory is that it is when the vector gets resized and the strings get moved into their new positions. The move semantics make the now "empty" strings "unconstructed". A new push_back will do an assign onto an unconstructed slot without "reconstructing" it. But this is where I get lost in the vector code... </p> <p> I have a short test program at <a class="ext-link" href="https://gist.github.com/DonOregano/10116264"><span class="icon">​</span>https://gist.github.com/DonOregano/10116264</a>. Compile and run and it will hopefully print out some information about the error. </p> <p> It appears that this error happens only on 64bit OSes. And I have only tried it on Linux (recent Ubuntu and Arch). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9855 Trac 1.4.3 anonymous Fri, 18 Apr 2014 15:21:19 GMT <link>https://svn.boost.org/trac10/ticket/9855#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9855#comment:1</guid> <description> <p> Moving does not put objects in invalid "unconstructed" states </p> </description> <category>Ticket</category> </item> <item> <author>Lars Hagström <lars@…></author> <pubDate>Fri, 18 Apr 2014 16:34:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9855#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9855#comment:2</guid> <description> <p> No, I should have clarified that. As far as I can interpret the code it looks like the string that is moved from is left in a state where it is not null terminated. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Mon, 21 Apr 2014 16:50:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9855#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9855#comment:3</guid> <description> <p> I fail to reproduce the error with current trunk code in Ubuntu 12 LTS x64, both in debug and release modes, with gcc 4.6 4.7 and 4.8 in release mode. Can you test with trunk code to see if changes from 1.55 have solved this problem? </p> </description> <category>Ticket</category> </item> <item> <author>Lars Hagström <lars@…></author> <pubDate>Fri, 02 May 2014 07:27:30 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9855#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9855#comment:4</guid> <description> <p> I tried it with boost trunk on Arch x64 with gcc 4.8.2, and it is still happening for me. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 02 May 2014 09:33:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9855#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9855#comment:5</guid> <description> <p> Sorry for saying "trunk" (old Subversion SCM), I wanted to say the "develop" branch in Git. Which did you tried? </p> </description> <category>Ticket</category> </item> <item> <author>Lars Hagström <lars@…></author> <pubDate>Fri, 02 May 2014 11:19:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9855#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9855#comment:6</guid> <description> <p> Yeah, I do the same :-). But yes, I did try git, but the master branch... </p> <p> I have now tried the develop branch instead, and I still get the problem. (And, just to be clear, I am pretty sure I'm building against the new Boost, since I get compilation errors when I add something random to managed_shared_memory.hpp). </p> </description> <category>Ticket</category> </item> </channel> </rss>