diff options
author | Brad King <brad.king@kitware.com> | 2020-09-21 12:55:21 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-09-21 12:55:29 (GMT) |
commit | c9bc062632c04e199a9a9e0cfc4fb16ccfcdc151 (patch) | |
tree | e1ba76a0360cd58e195b51d52a4b204c1e39ef3b /Source | |
parent | f332b05666701e956c54518c1ca756252a69aa18 (diff) | |
parent | 0412b55b838fd337dfa510db1b9be3a44f4f7de2 (diff) | |
download | CMake-c9bc062632c04e199a9a9e0cfc4fb16ccfcdc151.zip CMake-c9bc062632c04e199a9a9e0cfc4fb16ccfcdc151.tar.gz CMake-c9bc062632c04e199a9a9e0cfc4fb16ccfcdc151.tar.bz2 |
Merge topic 'foreach-int-parse-range-check' into release-3.18
0412b55b83 foreach: Fix crash parsing integer out of range
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5239
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmForEachCommand.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 3b82e0a..c68b785 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -365,6 +365,12 @@ bool TryParseInteger(cmExecutionStatus& status, const std::string& str, int& i) status.SetError(e.str()); cmSystemTools::SetFatalErrorOccured(); return false; + } catch (std::out_of_range&) { + std::ostringstream e; + e << "Integer out of range: '" << str << "'"; + status.SetError(e.str()); + cmSystemTools::SetFatalErrorOccured(); + return false; } return true; |