Opened 2 years ago

#12354 new Bugs

boost::asio::connect crash when connect_condition sets iterator to end

Reported by: snua12@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.60.0 Severity: Problem
Keywords: Cc:



auto getIPV4Only = [](const error_code& ec, iterator next) {
	resolver::iterator end;
	while (!ec && next != end) {
		if (next->endpoint().address().is_v4()) return next;
	return next;

connect(socket, iterator, getIPV4Only, ec); //<- crashes when getIPV4Only returns end


--- 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)

Attachments (0)

Change History (0)

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain chris_kohlhoff.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.