From: Peter van Dijk Date: Mon, 26 Mar 2018 18:52:57 +0000 (+0200) Subject: improve out of range reporting X-Git-Tag: auth-4.1.2~16^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58fca986c9f7710bf4f6ef1d16eeb52da5474f53;p=pdns improve out of range reporting (cherry picked from commit cccfa59b37d7b4dbe4e2429e495b2196e4244dc3) --- diff --git a/pdns/misc.cc b/pdns/misc.cc index 16b3908f5..3e2ea6117 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -1313,8 +1313,11 @@ unsigned int pdns_stou(const std::string& str, size_t * idx, int base) catch(std::invalid_argument& e) { throw std::invalid_argument(string(e.what()) + "; (invalid argument during std::stoul); data was \""+str+"\""); } + catch(std::out_of_range& e) { + throw std::out_of_range(string(e.what()) + "; (out of range during std::stoul); data was \""+str+"\""); + } if (result > std::numeric_limits::max()) { - throw std::out_of_range("stou"); + throw std::out_of_range("stoul returned result out of unsigned int range; data was \""+str+"\""); } return static_cast(result); }