[Boost-bugs] [Boost C++ Libraries] #13050: Serialization Fails on Optional Vector

Subject: [Boost-bugs] [Boost C++ Libraries] #13050: Serialization Fails on Optional Vector
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-06-01 08:04:53

#13050: Serialization Fails on Optional Vector
 Reporter: cristall@… | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.64.0 | Severity: Regression
 Keywords: |
 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.

 The following code will exhibit the issue:
 boost::optional<std::vector<std::uint8_t>> 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 >> opt;

 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.

 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.

 This was only tested on OSX using the following:
 Apple LLVM version 8.1.0 (clang-802.0.42)
 Target: x86_64-apple-darwin16.6.0
 Thread model: posix

Ticket URL: <https://svn.boost.org/trac/boost/ticket/13050>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-06-01 08:10:35 UTC