Ticket #4257: binary_invalid_signature.diff
File binary_invalid_signature.diff, 1.3 KB (added by , 12 years ago) |
---|
-
basic_binary_iarchive.ipp
16 16 #if defined(BOOST_NO_STDC_NAMESPACE) 17 17 namespace std{ 18 18 using ::memcpy; 19 using ::strlen; 20 using ::size_t; 19 21 } 20 22 #endif 21 23 … … 48 50 basic_binary_iarchive<Archive>::init(){ 49 51 // read signature in an archive version independent manner 50 52 std::string file_signature; 51 * this->This() >> file_signature; 53 try { 54 std::size_t l; 55 this->This()->load(l); 56 if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) { 57 // borland de-allocator fixup 58 #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) 59 if(NULL != file_signature.data()) 60 #endif 61 file_signature.resize(l); 62 // note breaking a rule here - could be a problem on some platform 63 if(0 < l) 64 this->This()->load_binary(&(*file_signature.begin()), l); 65 } 66 } 67 catch(archive_exception const &) { // catch stream_error archive exceptions 68 file_signature = ""; // will cause invalid_signature archive exception to be thrown below 69 } 52 70 if(file_signature != BOOST_ARCHIVE_SIGNATURE()) 53 71 boost::serialization::throw_exception( 54 72 archive_exception(archive_exception::invalid_signature)