Re: [Boost-bugs] [Boost C++ Libraries] #969: basic_binary_iprimitive::load_binary bug

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #969: basic_binary_iprimitive::load_binary bug
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-10-11 11:25:51


#969: basic_binary_iprimitive::load_binary bug
------------------------+---------------------------------------------------
  Reporter: anonymous | Owner: ramey
      Type: Bugs | Status: new
 Milestone: | Component: serialization
   Version: | Severity: Showstopper
Resolution: | Keywords:
------------------------+---------------------------------------------------
Comment (by Marvin Sielenkemper <Marvin.Sielenkemper_at_[hidden]>):

 There is another bug in this function that causes the test
 {{{
   void BoostBinaryWArchiveBug()
   {
     const std::string srcValue("12345");
     std::string dstValue;

     std::wostringstream os;
     boost::archive::binary_woarchive(os) << srcValue;

     std::wistringstream is(os.str());
     boost::archive::binary_wiarchive(is) >> dstValue;

     BOOST_CHECK_EQUAL(srcValue, dstValue);
   }
 }}}
 to fail with the error message
 {{{
 error in "BoostBinaryWArchiveBug": check srcValue == dstValue failed
 [12345 != 5234]
 }}}

 I found that bug in version 1.33.1, but the problem seems to still be
 present in 1.34.1. The bug is fixed by changing the memcpy-line from
 {{{
         std::memcpy(address, &t, s);
 }}}
 to
 {{{
         std::memcpy(static_cast<char*>(address) + (count - s), &t, s);
 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/969#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC