Re: [Boost-bugs] [Boost C++ Libraries] #12174: Tokenizer delivers additional null byte - string token

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12174: Tokenizer delivers additional null byte - string token
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-05-12 13:42:40


#12174: Tokenizer delivers additional null byte - string token
---------------------------------------------+-----------------------
  Reporter: Peter Caspers <pcaspers1973@…> | Owner: jsiek
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: tokenizer
   Version: Boost 1.59.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------------+-----------------------

Comment (by damian.meden@…):

 Hi, more data here:

 tokeniser holds an iterator to the beginning and the end of the container,
 ostringstream::str() will return a temporary container(in this case
 std::string) which will be deleted at the end of the expression where you
 are using it, meaning that the tokeniser will holds a iterator to a
 temporary object which was already destroyed, this is Undefined Behaviour,
 different compiler are doing different things.
 If you hold the temporal object in scope(string str=tmp.str()) meanwhile
 you tokenize it will fix the issue, that's the proper Idiom I would say.

 Also this is not related to the 'escaped' character \n, you can use any
 proper character there and will have the same results.

 Dam.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12174#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:50:20 UTC