foreach: Fix crash parsing integer out of range

This commit is contained in:
Ben McMorran
2020-09-17 23:40:08 -07:00
committed by Brad King
parent ac487f870b
commit 0412b55b83
5 changed files with 15 additions and 0 deletions
+6
View File
@@ -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;