[boost::serialization]: Dies with access violation (segfaults) reading beyond the end of archive.
When
1) trying to restore from archive the pointer to sample class, and
2) archive is over at this moment
boost::serialization causes Access Violation Fault in
file: basic_iarchive.cpp, line 470:
bpis_ptr = co.bpis_ptr;
The code to reproduce the fault follows.
--
Konstantin Andreev.
------------------------( cut here )----------------------
#include <iostream>
#include <sstream>
#include
Konstantin Andreev wrote: Make the following change: int main( void ) { Sample *obj_to = NULL; const Sample * const obj_fr = new Sample( 55, "**** test string *****" ); std::cout << *obj_fr; std::stringstream archbuf; boost::archive::text_oarchive *oa = new boost::archive::text_oarchive( archbuf, 3 ); *oa << obj_fr; std::cout << "-- archive content: >" << archbuf.str() << "<\n"; archbuf.flush(); // make this change delete oa; boost::archive::text_iarchive *ia = new boost::archive::text_iarchive( archbuf, 3 ); *ia >> obj_to; std::cout << *obj_to; /////////////////////////////////// *ia >> obj_to; // ARCHIVE IS OVER. BOOM !!! /////////////////////////////////// std::cout << *obj_to; delete ia; return 0; }
"Robert Ramey"
Make the following change:
*oa << obj_fr; std::cout << "-- archive content: >" << archbuf.str() << "<\n"; archbuf.flush(); // make this change
This change had no effect.
delete oa;
boost::archive::text_iarchive *ia = new boost::archive::text_iarchive( archbuf, 3 ); *ia >> obj_to; std::cout << *obj_to;
*ia >> obj_to; // ARCHIVE IS OVER. BOOM !!!
participants (2)
-
Konstantin Andreev
-
Robert Ramey