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 | ca5e30994049066f1bffc0635b3411bc5cacc6f9 (patch) | |
tree | db3f2176997ef40310887320b1106d4e0db7ac1f /Source/cmForEachCommand.cxx | |
parent | 4abf0747fccf04c16e48567dfc6d0f4a403dc96e (diff) | |
parent | 0412b55b838fd337dfa510db1b9be3a44f4f7de2 (diff) | |
download | CMake-ca5e30994049066f1bffc0635b3411bc5cacc6f9.zip CMake-ca5e30994049066f1bffc0635b3411bc5cacc6f9.tar.gz CMake-ca5e30994049066f1bffc0635b3411bc5cacc6f9.tar.bz2 |
Merge topic 'foreach-int-parse-range-check'
0412b55b83 foreach: Fix crash parsing integer out of range
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5239
Diffstat (limited to 'Source/cmForEachCommand.cxx')
-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 12fb55a..42df923 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -366,6 +366,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; |