summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-07-19 17:55:48 +0200
committerMaxime Coste <mawww@kakoune.org>2017-07-19 17:55:48 +0200
commitf87afbcb653a60cdb18860891919648b41c49603 (patch)
treeab4052f089bb448c1e5328c58c81aefcb3e60076 /src/input_handler.cc
parentd3f438810e12925b6fcd4718db0bb989a84348ee (diff)
Detect overflow using a long long for the computation result.
Closes #1306
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 63c69eed..7ad7aeed 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -235,8 +235,8 @@ public:
}
else if (cp and isdigit(*cp))
{
- int new_val = m_params.count * 10 + *cp - '0';
- if (new_val < 0)
+ long long new_val = (long long)m_params.count * 10 + *cp - '0';
+ if (new_val > std::numeric_limits<int>::max())
context().print_status({ "parameter overflowed", get_face("Error") });
else
m_params.count = new_val;