Opened 12 years ago

Last modified 11 years ago

#5499 new Bugs

Serialization backward compatability

Reported by: ybungalobill@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.46.1 Severity: Showstopper
Keywords: serialization compatability Cc:

Description

Boost 1.33.1 serializes class_id_type as int_least16_t (archive version 3). Current boost tries to load it as int for archive of version 6 and earlier. On my platform (VS2005) int is 32 bits, hence the deserialization fails.

The attached code creates and successfully loads 'out.boost103301.dat' when compiling with boost 1.33.1 and crashes due to failed assert in class_id_type constructor when loading with boost 1.46.1.

I'm upgrading from 1.33.1 to boost 1.46.1 now, so I mark it as 'Showstopper'.

Attachments (1)

serbug.zip (784 bytes ) - added by ybungalobill@… 12 years ago.

Download all attachments as: .zip

Change History (2)

by ybungalobill@…, 12 years ago

Attachment: serbug.zip added

comment:1 by s.skorniakov@…, 11 years ago

Same problem while upgrading from 1.36.0 to 1.48.0. I had checked basic_binary_iarchive::load_override for class_id_type - from versions 1.32.0 to 1.43.0 (serialization library versions from 3 to 7) its identical:

    void load_override(class_id_type & t, int){
        // upto 32K classes
        int_least16_t x;
        * this->This() >> x;
        t = class_id_type(x);
    }

In version 1.44.0 (library version 8) load_override for class_id_type is not specialized in basic_binary_iarchive. In version 1.48.0 I see

        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);
        }

I do not understand, why author made difference between version 7 and earlier versions. From my point of view, it is an error (introduced in version 1.45.0). Following code can read my old files (library versions 3-5) :

    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);
        }
    }
Note: See TracTickets for help on using tickets.