Actually, it doesn't seem to be
doing any check... looking at the contents of the XML emitted, the name is definitely
different than the one I'm requesting.
oarchive
<< BOOST_SERIALIZATION_NVP(foo);
iarchive
>> BOOST_SERIALIZATION_NVP(bar);
This works fine where foo &
bar are the same type (using xml_iarchive / oarchive)
Am I doing something wrong?
From: Dan Eaton
Sent: Monday, May 25, 2009 1:30 PM
To: 'boost-users@lists.boost.org'
Subject: [Serialization] Guard against attempting to deserialize the
wrong type
Hello,
I'm just wondering if NVP/XML archives check the name during
deserialization?
I just had a problem whereby I tried deserializing an object
to one type, but the archive actually contained a different (larger ) object
type. The first serialized element of the object just so happened to be an
unsigned int, and I was trying to deserialize an enum, so the output actually
seemed sensible, and didn't cause any problems until I later deserialized the
full object from the same archive, which caused a segmentation fault in the
boost::serialize source (trying to get ETI from a null pointer).
I was using a polymorphic text archive, and as I mentioned
above, am wondering if I switched to an XML archive if this sort of user-error
would be detected.
Thanks,
Dan Eaton |
Phone: +1.403.249.9099
Ext.295 |
|
|
|
|
Get superpowered! |
||
|
|
|
This e-mail may contain
information that is privileged and confidential and subject to legal
restrictions and penalties regarding its unauthorized disclosure or use. You
are prohibited from copying, distributing or otherwise using this information
if you are not the intended recipient. If you have received this e-mail in
error, please notify us immediately by return e-mail and delete this e-mail
and its attachments from your system. Thank you. |
||
|
|
|