Subject: [Boost-bugs] [Boost C++ Libraries] #12354: boost::asio::connect crash when connect_condition sets iterator to end
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-07-27 10:11:54
#12354: boost::asio::connect crash when connect_condition sets iterator to end
------------------------------+----------------------------
Reporter: snua12@⦠| Owner: chris_kohlhoff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
Version: Boost 1.60.0 | Severity: Problem
Keywords: |
------------------------------+----------------------------
example:
{{{
auto getIPV4Only = [](const error_code& ec, iterator next) {
resolver::iterator end;
while (!ec && next != end) {
if (next->endpoint().address().is_v4()) return next;
++next;
}
return next;
};
connect(socket, iterator, getIPV4Only, ec); //<- crashes when getIPV4Only
returns end
}}}
fix:
{{{
--- include/boost/asio/impl/connect.hpp (revision 1.6.0)
+++ include/boost/asio/impl/connect.hpp (working copy)
@@ -122,7 +122,9 @@
s.connect(*iter, ec);
if (!ec)
return iter;
- }
+ } else {
+ break;
+ }
}
if (!ec)
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12354> 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