> Can you please post a small, self-contained program that reproduces the
> segfault?
I understand that it would be very desirable to have a small self-contained
program reproducing it, but I am struggling a bit to provide this, as the issue
occurs in the interaction with the OS and the DNS.
I am currently unsure on how to wrap this into a simple reproducer.
My test program looks something like this, with the DNS having an incorrect
entry for "incorrectdnsentry.test.net" mapping to "dnsentry.test.net/" (the
slash is not legal here):
This set-up will produce a segfault on a Yocto-based Linux distribution.
#include <iostream>
#include <boost/asio.hpp>
int main(int argc, char* argv[])
{
try
{
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver(io_service);
boost::asio::ip::tcp::resolver::query query("incorrectdnsentry.test.net",
"80");
boost::asio::ip::tcp::resolver::iterator iter = resolver.resolve(query);
std::cout << "Host name was resolved to: " << iter->endpoint() << std::endl;
}
catch (const std::exception&)
{
std::cout << "Host name could not be resolved" << std::endl;
}
}
What can be easily demonstrated though, is, that the translate_addrinfo_error
function converts EAI_SYSTEM with errno=0 (which is triggered by the above
set-up) into a Boost error code that shows success.
So this program will output "Success".
int main(int argc, char* argv[])
{
auto ec =
boost::asio::detail::socket_ops::translate_addrinfo_error(EAI_SYSTEM);
std::cout << "Error message: " << ec.message() << std::endl;
}
Kind regards,
Nils
_______________________________________________
Boost-users mailing list
[email protected]
https://lists.boost.org/mailman/listinfo.cgi/boost-users