Re: [Boost-bugs] [Boost C++ Libraries] #1849: Deserialization of std::string overwrites non-copied contents.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1849: Deserialization of std::string overwrites non-copied contents.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-06-10 01:50:50


#1849: Deserialization of std::string overwrites non-copied contents.
-------------------------------------------------------------+--------------
  Reporter: Siegfried Kettlitz <dev_at_[hidden]> | Owner: ramey
      Type: Bugs | Status: assigned
 Milestone: Boost 1.35.1 | Component: serialization
   Version: Boost 1.35.0 | Severity: Showstopper
Resolution: | Keywords:
-------------------------------------------------------------+--------------
Comment (by ramey):

 as far as serialization is concerned std::string is primitive - that is
 its implemented as code intrinsic to the library - look at the
 documentation regarding serialization traits. The implementation has been
 move to text_iarchive_impl.ipp


 {{{
 template<class Archive>
 BOOST_ARCHIVE_DECL(void)
 text_iarchive_impl<Archive>::load(std::string &s)
 {
     std::size_t size;
     * this->This() >> size;
     // skip separating space
     is.get();
     // borland de-allocator fixup
     #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
     if(NULL != s.data())
     #endif
         s.resize(size);
     if(0 < size)
         is.read(&(*s.begin()), size);
 }
 }}}

 We ARE breaking the rules here. I think we had a discussion regarding this
 point some time ago. The concensus was that this hack was worth the risk
 to improve performance. Performance is a BIG issue - but of course the
 program has to work - I'll look into what to do about this. My first
 thought is another hack that it clear out the string if the sizes are the
 same.

 Robert Ramey

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1849#comment:6>
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:58 UTC