summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-08-31 20:34:45 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-08-31 20:34:45 +0100
commitb512f3220f5408eff3bf9075db628dd6b41179e8 (patch)
tree114a45994881e4d0dcd3fb04769d8e4c966040ab /src/input_handler.cc
parentc603d39a201c85b281a2b9d00595733b891a5ee4 (diff)
Detect normal mode count overflow
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 4fd118b2..9d471db3 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -214,7 +214,13 @@ public:
auto cp = key.codepoint();
if (cp and isdigit(*cp))
- m_params.count = m_params.count * 10 + *cp - '0';
+ {
+ int new_val = m_params.count * 10 + *cp - '0';
+ if (new_val < 0)
+ context().print_status({ "parameter overflowed", get_face("Error") });
+ else
+ m_params.count = new_val;
+ }
else if (key == Key::Backspace)
m_params.count /= 10;
else if (key == '\\')