Re: [Boost-bugs] [Boost C++ Libraries] #8722: The boost::asio::windows::stream_handle::read_some method may (incorrectly) throw when used with named-pipes in message mode (on Windows) and receives an ERROR_MORE_DATA error

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8722: The boost::asio::windows::stream_handle::read_some method may (incorrectly) throw when used with named-pipes in message mode (on Windows) and receives an ERROR_MORE_DATA error
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-09 22:31:48


#8722: The boost::asio::windows::stream_handle::read_some method may (incorrectly)
throw when used with named-pipes in message mode (on Windows) and receives
an ERROR_MORE_DATA error
-----------------------------------------+----------------------------
  Reporter: Dentcho Bankov <dbankov@…> | Owner: chris_kohlhoff
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: asio
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
-----------------------------------------+----------------------------
Changes (by aoney@…):

 * status: closed => reopened
 * resolution: fixed =>

Comment:

 On the above note 'Fixed on trunk in [85759]. Merged to release in
 [85838].'

 I think this may have been fixed incorrectly.

 First note that the fix in the trunk is *not* the fix suggested by Dentcho
 above. The fix that went into trunk has a "return 0;" at the end of the
 "if (!ok)" clause (see below), not in the inner clause like above.

 Thus, the change does not revert the logic back to how it looked in boost
 1.47 (in boost 1.48, the ERROR_MORE_DATA check was removed, only to be
 added back later).

 Now to the behavior - in message mode, ReadFile et. all will return
 partial data and ERROR_MORE_DATA to indicate additional parts of the
 message remain in the buffer. The boost method signature isn't rich enough
 to return this extra information (that the read splits a message rather
 than terminates it). However, boost *does* need to at least return the
 number of bytes read so far. And trunk's (and 1.55.0's) logic below,
 unlike Dentcho's logic above, clearly fails to do that because the return
 0 is located differently:

   if (!ok)
   {
     DWORD last_error = ::GetLastError();
     if (last_error != ERROR_MORE_DATA)
     {
       if (last_error == ERROR_HANDLE_EOF)
       {
         ec = boost::asio::error::eof;
       }
       else
       {
         ec = boost::system::error_code(last_error,
             boost::asio::error::get_system_category());
       }
     }
     return 0;
   }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8722#comment:3>
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:16 UTC