From b512f3220f5408eff3bf9075db628dd6b41179e8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 31 Aug 2015 20:34:45 +0100 Subject: [PATCH] Detect normal mode count overflow --- src/input_handler.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 == '\\')