diff options
authorEdwin Mons <>2018-09-28 14:17:55 (GMT)
committerEdwin Mons <>2018-10-01 07:23:40 (GMT)
commitabd5ca5d4960765f25da426c3dd20e2316d75b59 (patch)
treedcf20ab2069f658b048a8bceebd2d997bafd132d /Swiften
parent1536284a15743f6ec41d3230177a24d245158a9d (diff)
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
Diffstat (limited to 'Swiften')
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>();