Re: [Boost-bugs] [Boost C++ Libraries] #9370: segmentation fault with serialization

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9370: segmentation fault with serialization
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-11-30 01:45:44


#9370: segmentation fault with serialization
-------------------------------+---------------------------
  Reporter: florian.seidel@… | Owner: ramey
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: serialization
   Version: Boost 1.49.0 | Severity: Showstopper
Resolution: | Keywords:
-------------------------------+---------------------------

Comment (by ramey):

 I'm guessing that this problem is due to the fact that we're reading the
 string before it's closed. Try the following:


 {{{

 {
         ostringstream os(ios_base::out|ios_base::binary);
         {
                 boost::archive::binary_oarchive oar(os);

                 oar.register_type((C*)0);
                 oar.register_type((B*)0);

                 oar & p1;
         }
         const string data(os.str());

         cout << "Serialization done, data size [bytes]: " << data.size()
 << endl;
 } // closes file os
 {
         istringstream is(data, ios_base::in|ios_base::binary);
         {
                 boost::archive::binary_iarchive iar(is);
                 iar.register_type((B*)0);
                 iar & p2;
         }

         cout << "Deserialization done\n";
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9370#comment:2>
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-02-16 18:50:14 UTC