Crash when serializing binary object to XML archive
Using Boost 1.36, I'm seeing a crash when serializing a 256K malloc block using binary_object to an XML archive, something like this: using namespace boost; serialization::binary_object dataObject = serialization::make_binary_object(dataBlock, dataSize); ar << serialization::make_nvp("data_contents", dataObject); The crash is in boost::archive::iterators::transform_width<char const*, 6, 8, char>::fill () template<class Base, int BitsOut, int BitsIn, class CharType> CharType transform_width<Base, BitsOut, BitsIn, CharType>::fill(){ CharType retval = 0; unsigned int missing_bits = BitsOut; for(;;){ unsigned int bcount; if(! m_bufferfull){ m_buffer = * this->base_reference(); <-------- crash here m_bufferfull = true; bcount = BitsIn; } else ... and the stack back up to my object serialization looks like: #0 0x0008f12e in boost::archive::iterators::transform_width<char const*, 6, 8, char>::fill () at transform_width.hpp:139 #1 0x0008f12e in boost::archive::iterators::transform_width<char const*, 6, 8, char>::dereference_impl () at transform_width.hpp:71 #2 0x0008f12e in boost::iterator_facade<boost::archive::iterators::transform_width<char const*, 6, 8, char>, char, boost::single_pass_traversal_tag, char, int>::operator* () at transform_width.hpp:78 #3 0x0008f12e in dereference<boost::archive::iterators::transform_width<const char*, 6, 8, char> > [inlined] () at transform_width.hpp:137 #4 0x0008f12e in boost::archive::iterators::transform_width<char const*, 6, 8, char>::dereference () at transform_width.hpp:635 #5 0x0008f12e in boost ::iterator_facade < boost ::transform_iterator <boost::archive::iterators::detail::from_6_bit<char>, boost::archive::iterators::transform_width<char const*, 6, 8, char>, boost::use_default, boost::use_default>, char, boost::single_pass_traversal_tag, char, int>::operator* () at transform_width.hpp:517 #6 0x0008f12e in dereference < boost ::transform_iterator <boost::archive::iterators::detail::from_6_bit<char>, boost::archive::iterators::transform_width<const char*, 6, 8, char>, boost::use_default, boost::use_default> > [inlined] () at transform_width.hpp:80 #7 0x0008f12e in boost ::transform_iterator <boost::archive::iterators::detail::from_6_bit<char>, boost::archive::iterators::transform_width<char const*, 6, 8, char>, boost::use_default, boost::use_default>::dereference () at transform_width.hpp:635 #8 0x0008f12e in boost ::archive ::iterators ::insert_linebreaks < boost ::archive ::iterators ::base64_from_binary<boost::archive::iterators::transform_width<char const*, 6, 8, char>, char>, 72, char const>::dereference () at insert_linebreaks.hpp:517 #9 0x0008f12e in dereference < boost ::archive ::iterators ::insert_linebreaks < boost ::archive ::iterators ::base64_from_binary<boost::archive::iterators::transform_width<const char*, 6, 8, char>, char>, 72, const char> > [inlined] () at insert_linebreaks.hpp:517 #10 0x0008f12e in boost ::iterator_facade < boost ::archive ::iterators ::insert_linebreaks < boost ::archive ::iterators ::base64_from_binary<boost::archive::iterators::transform_width<char const*, 6, 8, char>, char>, 72, char const>, char const, boost::single_pass_traversal_tag, char const, int>::operator* () at iterator_facade.hpp:635 #11 0x0008f12e in copy < boost ::archive ::iterators ::insert_linebreaks < boost ::archive ::iterators ::base64_from_binary<boost::archive::iterators::transform_width<const char*, 6, 8, char>, char>, 72, const char>, boost::archive::iterators::ostream_iterator<char> > [inlined] () at iterator_facade.hpp:270 #12 0x0008f12e in copy < boost ::archive ::iterators ::insert_linebreaks < boost ::archive ::iterators ::base64_from_binary<boost::archive::iterators::transform_width<const char*, 6, 8, char>, char>, 72, const char>, boost::archive::iterators::ostream_iterator<char> > [inlined] () at iterator_facade.hpp:270 #13 0x0008f12e in boost::archive::basic_text_oprimitive<std::ostream>::save_binary (this=0xbffff178, address=0x423000, count=262144) at libs/ serialization/src/basic_text_oprimitive.cpp:317 #14 0x000aaae4 in boost ::archive ::xml_oarchive_impl<boost::archive::xml_oarchive>::save_binary (this=0xbffff168, address=0x463000, count=4599808) at libs/ serialization/src/basic_text_oprimitive.cpp:317 #15 0x00054032 in boost ::serialization::binary_object::save<boost::archive::xml_oarchive> (this=0xbfffe730, ar=@0xbffff168) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #16 0x00054059 in boost ::serialization::access::member_save<boost::archive::xml_oarchive, boost::serialization::binary_object const> (ar=@0xbffff168, t=@0xbfffe730, file_version=0) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #17 0x00054081 in boost ::serialization::detail::member_saver<boost::archive::xml_oarchive, boost::serialization::binary_object>::invoke (ar=@0xbffff168, t=@0xbfffe730, file_version=0) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #18 0x000540a9 in boost::serialization::split_member<boost::archive::xml_oarchive, boost::serialization::binary_object> (ar=@0xbffff168, t=@0xbfffe730, file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317 #19 0x000540d1 in boost ::serialization ::binary_object::serialize<boost::archive::xml_oarchive> (this=0xbfffe730, ar=@0xbffff168, file_version=0) at libs/ serialization/src/basic_text_oprimitive.cpp:317 #20 0x000540f9 in boost::serialization::access::serialize<boost::archive::xml_oarchive, boost::serialization::binary_object> (ar=@0xbffff168, t=@0xbfffe730, file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317 #21 0x00054121 in boost::serialization::serialize<boost::archive::xml_oarchive, boost::serialization::binary_object> (ar=@0xbffff168, t=@0xbfffe730, file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317 #22 0x00054165 in boost::serialization::serialize_adl<boost::archive::xml_oarchive, boost::serialization::binary_object> (ar=@0xbffff168, t=@0xbfffe730, file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317 #23 0x0005418e in boost ::archive::detail::save_non_pointer_type<boost::archive::xml_oarchive, boost::serialization::binary_object>::save_only::invoke (ar=@0xbffff168, t=@0xbfffe730) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #24 0x000541ae in boost ::archive::detail::save_non_pointer_type<boost::archive::xml_oarchive, boost::serialization::binary_object>::invoke (ar=@0xbffff168, t=@0xbfffe730) at libs/serialization/src/basic_text_oprimitive.cpp:317 #25 0x000541ce in boost::archive::save<boost::archive::xml_oarchive, boost::serialization::binary_object> (ar=@0xbffff168, t=@0xbfffe730) at libs/serialization/src/basic_text_oprimitive.cpp:317 #26 0x000541f8 in boost ::archive ::detail ::common_oarchive < boost ::archive ::xml_oarchive>::save_override<boost::serialization::binary_object const> (this=0xbffff168, t=@0xbfffe730) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #27 0x00054242 in boost ::archive ::basic_xml_oarchive < boost ::archive ::xml_oarchive>::save_override<boost::serialization::binary_object> (this=0xbffff168, t=@0xbfffe738) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #28 0x0005428e in boost ::archive ::detail::interface_oarchive<boost::archive::xml_oarchive>::operator<< <boost::serialization::nvp<boost::serialization::binary_object> const> (this=0xbffff168, t=@0xbfffe738) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #29 0x00054301 in MacTierra::Soup::save<boost::archive::xml_oarchive> (this=0x500880, ar=@0xbffff168, version=0) at libs/serialization/src/ basic_text_oprimitive.cpp:317 #30 0x0005432b in boost ::serialization::access::member_save<boost::archive::xml_oarchive, MacTierra::Soup const> (ar=@0xbffff168, t=@0x500880, file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317 #31 0x00054353 in boost ::serialization::detail::member_saver<boost::archive::xml_oarchive, MacTierra::Soup>::invoke (ar=@0xbffff168, t=@0x500880, file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317 #32 0x0005437b in boost::serialization::split_member<boost::archive::xml_oarchive, MacTierra::Soup> (ar=@0xbffff168, t=@0x500880, file_version=0) at libs/ serialization/src/basic_text_oprimitive.cpp:317 #33 0x000543a3 in MacTierra::Soup::serialize<boost::archive::xml_oarchive> (this=0x500880, ar=@0xbffff168, file_version=0) at libs/serialization/ src/basic_text_oprimitive.cpp:317 This is on Mac OS X, using gcc 4.0, compiling for intel. Has anyone seen this crash? Should I reduce and file a bug? Simon
Simon Fraser wrote:
Using Boost 1.36, I'm seeing a crash when serializing a 256K malloc block using binary_object to an XML archive, something like this:
There is a trak item which refers to transform_width. I would guess/hope that this will be resolved when that trak item is addressed. Robert Ramey
I found this one: <http://svn.boost.org/trac/boost/ticket/1481> but it's closed as "wontfix" (by you), and it's not clear whether it's the same issue. If it is, shouldn't another ticket be opened to fix serialization not to use transform_width in this way? This crash prevents me from using XML serialization, so I'd appreciate any hints on workarounds. Thanks Simon On Sep 6, 2008, at 9:41 am, Robert Ramey wrote:
Simon Fraser wrote:
Using Boost 1.36, I'm seeing a crash when serializing a 256K malloc block using binary_object to an XML archive, something like this:
There is a trak item which refers to transform_width. I would guess/ hope that this will be resolved when that trak item is addressed.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I changed my mind. There is currently an item on the active list which demonstrates how to fix it and this I will do. Assuming the problem is what I think it is, you might try a different size binary object - e.g. some multiple of 3 bytes. That should work around the problem. Robert Ramey Simon Fraser wrote:
I found this one: <http://svn.boost.org/trac/boost/ticket/1481> but it's closed as "wontfix" (by you), and it's not clear whether it's the same issue. If it is, shouldn't another ticket be opened to fix serialization not to use transform_width in this way?
This crash prevents me from using XML serialization, so I'd appreciate any hints on workarounds.
Thanks Simon
On Sep 6, 2008, at 9:41 am, Robert Ramey wrote:
Simon Fraser wrote:
Using Boost 1.36, I'm seeing a crash when serializing a 256K malloc block using binary_object to an XML archive, something like this:
There is a trak item which refers to transform_width. I would guess/ hope that this will be resolved when that trak item is addressed.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Sep 6, 2008, at 10:30 am, Robert Ramey wrote:
I changed my mind. There is currently an item on the active list which demonstrates how to fix it and this I will do.
That's good news, thanks. Could you point me to that item?
Assuming the problem is what I think it is, you might try a different size binary object - e.g. some multiple of 3 bytes. That should work around the problem.
Unfortunately the binary object size is an inherent property of my model and is not adjustable (unless I play games with adding 3 bytes to the end on write, and stripping them off on read, which I'd rather not do). Thanks Simon
Robert Ramey
Simon Fraser wrote:
I found this one: <http://svn.boost.org/trac/boost/ticket/1481> but it's closed as "wontfix" (by you), and it's not clear whether it's the same issue. If it is, shouldn't another ticket be opened to fix serialization not to use transform_width in this way?
This crash prevents me from using XML serialization, so I'd appreciate any hints on workarounds.
Thanks Simon
On Sep 6, 2008, at 9:41 am, Robert Ramey wrote:
Simon Fraser wrote:
Using Boost 1.36, I'm seeing a crash when serializing a 256K malloc block using binary_object to an XML archive, something like this:
There is a trak item which refers to transform_width. I would guess/ hope that this will be resolved when that trak item is addressed.
Robert Ramey
participants (2)
-
Robert Ramey
-
Simon Fraser