[Boost-bugs] [Boost C++ Libraries] #7301: Inconsistent use of load_/save_override for serialized file signature

Subject: [Boost-bugs] [Boost C++ Libraries] #7301: Inconsistent use of load_/save_override for serialized file signature
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-08-29 14:24:49


#7301: Inconsistent use of load_/save_override for serialized file signature
----------------------------------------------------------+-----------------
 Reporter: Paul Barba <paul.barba@…> | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: serialization, save_override, file signature |
----------------------------------------------------------+-----------------
 basic_binary_oarchive.ipp::39 writes the file signature like this:
 * this->This() << file_signature;

 Which if you're using your own binary_oarchive subclass to do custom
 serialization, ends up using your save_override(std::string&, int)
 function to write the signature.

 However,
 basic_binary_iarchive.ipp::55 reads the file signature like so:
 std::size_t l;
 this->This()->load(l);
 if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) {
 ...
 file_signature.resize(l);
 if(0 < l){
 ...
 this->This()->load_binary(&(*file_signature.begin()), l);
 }
 }

 which does not make use of your load_override(std::string&, int) function.
 Therefore if you change how strings are written, you get an invalid
 signature exception on deserialization.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7301>
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:10 UTC