Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4660: Error read binary archive, created by old boost version
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-20 09:33:59
#4660: Error read binary archive, created by old boost version
---------------------------------------+------------------------------------
Reporter: serge-voropaev@⦠| Owner: ramey
Type: Bugs | Status: reopened
Milestone: Boost 1.45.0 | Component: serialization
Version: Boost 1.45.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------+------------------------------------
Comment (by markus.henschel@â¦):
Compatibility ist still broken. We have binary archives from 1.34.1 that
fail to load in 1.51 now. I stepped through the code and it seems like the
class_id is 2 bytes in 1.34.1 but 1.51 tries to load it as 4 bytes. See
basic_binary_iarchive.hpp:
This is what the code looks like in 1.51
{{{
void load_override(class_id_type & t, int version){
library_version_type lvt = this->get_library_version();
if(boost::archive::library_version_type(7) < lvt){
this->detail_common_iarchive::load_override(t, version);
}
else
if(boost::archive::library_version_type(6) < lvt){
int_least16_t x=0;
* this->This() >> x;
t = boost::archive::class_id_type(x);
}
else{
int x=0;
* this->This() >> x;
t = boost::archive::class_id_type(x);
}
}
}}}
1.34.1 has library version 4 and had this code
{{{
void load_override(class_id_type & t, int){
// upto 32K classes
int_least16_t x;
* this->This() >> x;
t = class_id_type(x);
}
}}}
So it seems to me that this is the problem. I checked the source code of
releases from 1.34 to 1.40 (library version 6) and it looks like the class
id has always been 16 bits. So this is was the code should look like:
{{{
void load_override(class_id_type & t, int version){
library_version_type lvt = this->get_library_version();
if(boost::archive::library_version_type(7) < lvt){
this->detail_common_iarchive::load_override(t, version);
}
else
{
int_least16_t x=0;
* this->This() >> x;
t = boost::archive::class_id_type(x);
}
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4660#comment:47> 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