Opened 11 years ago

Last modified 10 years ago

#6730 new Bugs

error reading archive created by old version when it contains pointer

Reported by: d s m a l l @… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:

Description

Problem is similar to ticket 4660. Fwiw we just discovered a gap in our unit tests. :(

Code below contains our local fix. Note that we only have used lib ver 3 and lib ver 5 and that this is the reason the fix only targets those versions.

One last word, I checked the latest code ( 1.49 ) and it seems to contain the same flaw as 1.45.

    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
        if(boost::archive::library_version_type(3) == lvt || boost::archive::library_version_type(5) == lvt ){
#pragma message( "CTMS fix for serialization bug ( lack of backwards compatability ) introduced by boost 1.45." )
            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);
        }
    }

Change History (1)

comment:1 by viboes, 10 years ago

Component: Noneserialization
Owner: set to Robert Ramey
Note: See TracTickets for help on using tickets.