Subject: [Boost-bugs] [Boost C++ Libraries] #7240: serialization backward compatibility issue with class_id_type attribute
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-08-16 10:42:30
#7240: serialization backward compatibility issue with class_id_type attribute
-----------------------------------+----------------------------------------
Reporter: ggagniard@⦠| Owner: ramey
Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.50.0 | Severity: Regression
Keywords: |
-----------------------------------+----------------------------------------
There is a backward compatibility issue in current boost::serialization
around the class_id_type attribute.
It is actually impossible to read binary archives written with boost 1.39
(format 5) with a boost release > 1.43.
For instance, with boost 1.47.0 :
test_serialization:
/home/ggagniard/dev/boost-1.47.0.bug/include/boost/archive/basic_archive.hpp:116:
boost::archive::class_id_type::class_id_type(int): Assertion `t_ <=
boost::integer_traits<base_type>::const_max' failed.
Please note that the same error still occurs with boost 1.50.0, the
current stable release.
After having a look at the class_id_type serialization in binary archives,
I think I found the culprit :
In boost/archive/basic_binary_iarchive.hpp :
{{{
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);
}
}
}}}
Here, archives whose version <= 6 get their class_id_type read as an int
...
However, in boost 1.43 (format 7) :
{{{
void load_override(class_id_type & t, int){
// upto 32K classes
int_least16_t x=0;
* this->This() >> x;
t = class_id_type(x);
}
}}}
It is clear than any library version <= 7 have their class_id_type
serialized as a int_least16_t, so the current load_override method is
incorrect for versions <= 6 ...
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7240> 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