Detect overflow using a long long for the computation result.
Closes #1306
This commit is contained in:
parent
d3f438810e
commit
f87afbcb65
|
@ -235,8 +235,8 @@ public:
|
||||||
}
|
}
|
||||||
else if (cp and isdigit(*cp))
|
else if (cp and isdigit(*cp))
|
||||||
{
|
{
|
||||||
int new_val = m_params.count * 10 + *cp - '0';
|
long long new_val = (long long)m_params.count * 10 + *cp - '0';
|
||||||
if (new_val < 0)
|
if (new_val > std::numeric_limits<int>::max())
|
||||||
context().print_status({ "parameter overflowed", get_face("Error") });
|
context().print_status({ "parameter overflowed", get_face("Error") });
|
||||||
else
|
else
|
||||||
m_params.count = new_val;
|
m_params.count = new_val;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user