Server crashes when HTTP version number is large
Description: the server crashes when you type a very large HTTP-version number.
Error message: "terminate called after throwing an instance of 'std::out_of_range' what(): stof"
How to reproduce run web-server as instructed in the project's readme. While server is running, use telnet localhost 8080 to send a GET-request. In order to make the server crash, type "GET "urlstring" /HTTP.
Backtrace
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007ffff705f8b1 in __GI_abort () at abort.c:79 #2 0x00007ffff76b4957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff76baae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007ffff76bab21 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00007ffff76bad54 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff76b6837 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #7 0x00005555556625f8 in float __gnu_cxx::__stoa<float, float, char>(float ()(char const, char**), char const*, char const*, unsigned long*) () #8 0x0000555555655a5a in std::__cxx11::stof(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, unsigned long*) () #9 0x000055555566f55f in SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::write(std::shared_ptr<SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Session> const&, std::function<void (std::shared_ptr<SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response>, std::shared_ptr<SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Request>)>&)::{lambda(SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response*)#1}::operator()(SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response*) const::{lambda(boost::system::error_code const&)#1}::operator()(boost::system::error_code const) const () #10 0x000055555567b594 in std::_Function_handler<void (boost::system::error_code const&), SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::write(std::shared_ptr<SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Session> const&, std::function<void (std::shared_ptr<SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response>, std::shared_ptr<SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Request>)>&)::{lambda(SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response*)#1}::operator()(SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response*) const::{lambda(boost::system::error_code const&)#1}>::_M_invoke(std::_Any_data const&, boost::system::error_code const&) () #11 0x000055555567b719 in std::function<void (boost::system::error_code const&)>::operator()(boost::system::error_code const&) const () #12 0x000055555567516b in SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}::operator()(boost::system::error_code const&, unsigned long) ---Type to continue, or q to quit--- const () #13 0x00005555556870f7 in boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}>::operator()(boost::system::error_code const&, unsigned long) () #14 0x0000555555683a0f in boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >::operator()(boost::system::error_code const&, unsigned long, int) () #15 0x00005555556af46e in boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>::operator()() () #16 0x00005555556ae3b3 in void boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>&, ...) () #17 0x00005555556ac61f in void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>, {lambda(boost::system::error_code const&, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail---Type to continue, or q to quit--- ::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>&, {lambda(boost::system::error_code const&, unsigned long)#1}&) () #18 0x00005555556aa71b in void boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>, std::allocator, {lambda(boost::system::error_code const&, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>&, boost::asio::detail::write_streambuf_handler<std::allocator, {lambda(boost::system::error_code const&, unsigned long)#1}>*) () #19 0x00005555556a71fb in void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>&, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}&) () #20 0x00005555556a1790 in void boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator<ch---Type to continue, or q to quit--- ar>, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>&, boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}>*) () #21 0x000055555569c910 in void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> >, boost::system::error_code, unsigned long>&, boost::asio::detail::write_streambuf_handler<std::allocator, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}>&) () #22 0x00005555556983aa in boost::asio::detail::reactive_socket_send_op<boost::asio::const_buffers_1, boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator<ch---Type to continue, or q to quit--- ar>, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::Response::send_on_delete(std::function<void (boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, unsigned long)#1}> > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) () #23 0x0000555555658170 in boost::asio::detail::task_io_service_operation::complete(boost::asio::detail::task_io_service&, boost::system::error_code const&, unsigned long) () #24 0x000055555565b0f5 in boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lockboost::asio::detail::posix_mutex&, boost::asio::detail::task_io_service_thread_info&, boost::system::error_code const&) () #25 0x000055555565aab1 in boost::asio::detail::task_io_service::run(boost::system::error_code&) () #26 0x000055555565b3b4 in boost::asio::io_service::run() () #27 0x000055555566722d in SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp > >::start(std::function<void (unsigned short)> const&) () #28 0x0000555555654fd3 in main ()