diff options
author | Edwin Mons <edwin.mons@isode.com> | 2018-09-28 14:17:55 (GMT) |
---|---|---|
committer | Edwin Mons <edwin.mons@isode.com> | 2018-10-01 07:23:40 (GMT) |
commit | abd5ca5d4960765f25da426c3dd20e2316d75b59 (patch) | |
tree | dcf20ab2069f658b048a8bceebd2d997bafd132d | |
parent | 1536284a15743f6ec41d3230177a24d245158a9d (diff) | |
download | swift-abd5ca5d4960765f25da426c3dd20e2316d75b59.zip swift-abd5ca5d4960765f25da426c3dd20e2316d75b59.tar.bz2 |
Catch numeric cast errors in BoostConnectionServer
When BoostConnectionServer tries to set up a listener, it casts an int
to an unsigned short, which may throw an uncaught exception if the cast
fails.
Test-Information:
Unit tests pass on Debian 9
Test server code no longer crashes when it tries to set up a listener on
an invalid port.
Change-Id: If6b920e54481ce6bf174df01d14ad12eff90e3f4
-rw-r--r-- | Swiften/Network/BoostConnectionServer.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp index 34b5799..f25f915 100644 --- a/Swiften/Network/BoostConnectionServer.cpp +++ b/Swiften/Network/BoostConnectionServer.cpp @@ -58,6 +58,9 @@ boost::optional<BoostConnectionServer::Error> BoostConnectionServer::tryStart() return UnknownError; } } + catch (const boost::numeric::bad_numeric_cast&) { + return UnknownError; + } return boost::optional<Error>(); } |