[serialization] 1.34.0 bug

basic_binary_iprimitive.hpp, basic_binary_iprimitive<Archive, Elem, Tr>::load_binary: std::streamsize s = count / sizeof(Elem); std::streamsize scount = m_sb.sgetn( static_cast<Elem *>(address), s ); if(count != static_cast<std::size_t>(s)) boost::throw_exception( archive_exception(archive_exception::stream_error) ); If sizeof(Elem) != 1, exception will be thrown. Looks like wide binary iarchives was never been tested.

Sergey Skorniakov wrote:
basic_binary_iprimitive.hpp, basic_binary_iprimitive<Archive, Elem, Tr>::load_binary:
std::streamsize s = count / sizeof(Elem); std::streamsize scount = m_sb.sgetn( static_cast<Elem *>(address), s ); if(count != static_cast<std::size_t>(s)) boost::throw_exception( archive_exception(archive_exception::stream_error) );
If sizeof(Elem) != 1, exception will be thrown. Looks like wide binary iarchives was never been tested.
True - wide binary archives result from the implementation scheme. I couldn't think of a use case for them. Robert Ramey
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Sergey Skorniakov wrote:
basic_binary_iprimitive.hpp, basic_binary_iprimitive<Archive, Elem, Tr>::load_binary:
std::streamsize s = count / sizeof(Elem); std::streamsize scount = m_sb.sgetn( static_cast<Elem *>(address), s ); if(count != static_cast<std::size_t>(s)) boost::throw_exception( archive_exception(archive_exception::stream_error) );
If sizeof(Elem) != 1, exception will be thrown. Looks like wide binary iarchives was never been tested.
True - wide binary archives result from the implementation scheme. I couldn't think of a use case for them.
The real problem with this typo is that narrow binary archive can't reports about errors - count != static_cast<std::size_t>(s) always evaluates to true if sizeof(Elem) == 1. I think that 'scount' should be used instead of 'count'.
participants (2)
-
Robert Ramey
-
Sergey Skorniakov