Boost C++ Libraries: Ticket #13050: Serialization Fails on Optional Vector https://svn.boost.org/trac10/ticket/13050 <p> When serializing a boost::optional with T = std::vector, it will fail to load. This is a regression in Boost 1.64 as 1.63 does not appear to exhibit the issue. </p> <p> The following code will exhibit the issue: </p> <pre class="wiki">boost::optional&lt;std::vector&lt;std::uint8_t&gt;&gt; opt{}; std::string in_str{ "22 serialization::archive 15 0 0 1 0 4 0 0 1 2 3" }; std::istringstream iss{in_str}; boost::archive::text_iarchive ia{iss}; ia &gt;&gt; opt; </pre><p> This should set opt to a valid optional containing a vector of {0, 1, 2, 3}. However it will instead either segfault or enter an infinite loop. </p> <p> The cause appears to be related to a change in boost/serialization/optional.hpp, where stack storage was changed from using detail::stack_construct to detail::stack_allocate. The error appears to come from trying to use an undefined vector object. </p> <p> This was only tested on OSX using the following: </p> <pre class="wiki">Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.6.0 Thread model: posix </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13050 Trac 1.4.3 anonymous Fri, 02 Jun 2017 15:46:14 GMT <link>https://svn.boost.org/trac10/ticket/13050#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13050#comment:1</guid> <description> <p> It seems this may be already be fixed in the latest serialization lib based on this commit: </p> <p> <a class="ext-link" href="https://github.com/boostorg/serialization/commit/632df7aab5e1fb3458ea53be2704c83462b2caa9"><span class="icon">​</span>https://github.com/boostorg/serialization/commit/632df7aab5e1fb3458ea53be2704c83462b2caa9</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sun, 04 Jun 2017 17:20:32 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/13050#comment:2 https://svn.boost.org/trac10/ticket/13050#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket