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 04:46:52


#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 anonymous):

 You're pointing to the right location.

 Obviously your code is correct with:

 {{{
 is.read(&(*s.begin()), size);
 }}}

 The call to .begin() causes the string to copy and .data() changes
 locations.

 But in 1.35.0 release this line is executed.
 {{{
 is.read(const_cast<char *>(s.data()), size);
 }}}

 .data() obviously doesn't copy the string and there's also the bad cast.

 So the issue is fixed in the next release.

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