From 95606d23362cea6898f04d75a1483d928532af1e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 1 Dec 2020 21:56:55 +1100 Subject: [PATCH] Avoid potential use after free of the mode name This can be an issue with NextKey that now does not have a static mode name. --- src/input_handler.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/input_handler.cc b/src/input_handler.cc index b7f83592..14f9240b 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1596,6 +1596,7 @@ void InputHandler::pop_mode(InputMode* mode) kak_assert(m_mode_stack.back().get() == mode); kak_assert(m_mode_stack.size() > 1); + RefPtr keep_alive{mode}; // Ensure prev_name stays valid StringView prev_name = mode->name(); current_mode().on_disabled(false);