Re: [Boost-bugs] [Boost C++ Libraries] #8337: The internal representation of "std::string(this->code()->message())" escapes, but is destroyed when it exits scope.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8337: The internal representation of "std::string(this->code()->message())" escapes, but is destroyed when it exits scope.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-28 23:57:16


#8337: The internal representation of "std::string(this->code()->message())"
escapes, but is destroyed when it exits scope.
----------------------------------------------+-----------------------------
  Reporter: Richard <legalize@…> | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords:
----------------------------------------------+-----------------------------
Changes (by viboes):

  * owner: anthonyw => viboes
  * status: new => assigned


Old description:

> Coverity static analysis reported the following problem:
>
> class BOOST_SYMBOL_VISIBLE future_error
> : public std::logic_error
> {
> system::error_code ec_;
> public:
> future_error(system::error_code ec)
> : logic_error(ec.message()),
> ec_(ec)
> {
> }
>
> const system::error_code& code() const BOOST_NOEXCEPT
> {
> return ec_;
> }
> const char* what() const BOOST_THREAD_NOEXCEPT_OR_THROW
> {
> CID 10932 (#2 of 2): Wrapper object use after free (WRAPPER_ESCAPE)1.
> escape: The internal representation of
> "std::string(this->code()->message())" escapes, but is destroyed when it
> exits scope.
> return code().message().c_str();
> }
> };

New description:

 Coverity static analysis reported the following problem:


 {{{
 class BOOST_SYMBOL_VISIBLE future_error
      : public std::logic_error
  {
      system::error_code ec_;
  public:
      future_error(system::error_code ec)
      : logic_error(ec.message()),
        ec_(ec)
      {
      }

      const system::error_code& code() const BOOST_NOEXCEPT
      {
        return ec_;
      }
      const char* what() const BOOST_THREAD_NOEXCEPT_OR_THROW
      {
  CID 10932 (#2 of 2): Wrapper object use after free (WRAPPER_ESCAPE)1.
 escape: The internal representation of
 "std::string(this->code()->message())" escapes, but is destroyed when it
 exits scope.
       return code().message().c_str();
      }
  };
 }}}

--
Comment:
 Could you clarify what is the bug?
-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8337#comment:1>
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:12 UTC