summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2023-07-04 19:33:10 +1000
committerMaxime Coste <mawww@kakoune.org>2023-07-04 19:33:10 +1000
commit96ff68aeae0f21ab9b1e717987f867d17344c8bf (patch)
tree9b3344f2dc5263c83aca090b5002caf7561eec8c /src
parent53fed4b8b937837c014f43d984878fa372cc5180 (diff)
parent42be0057a68f30b439ccb52159fa756e82b61c98 (diff)
Merge remote-tracking branch 'krobelus/fix-remap-uaf'
Diffstat (limited to 'src')
-rw-r--r--src/keymap_manager.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/keymap_manager.cc b/src/keymap_manager.cc
index 81efe7ed..26579bf7 100644
--- a/src/keymap_manager.cc
+++ b/src/keymap_manager.cc
@@ -13,6 +13,9 @@ namespace Kakoune
void KeymapManager::map_key(Key key, KeymapMode mode,
KeyList mapping, String docstring)
{
+ if (auto it = m_mapping.find(KeyAndMode{key, mode}); it != m_mapping.end())
+ if (it->value.is_executing)
+ throw runtime_error("cannot map key that is currently executing");
m_mapping[KeyAndMode{key, mode}] = {std::move(mapping), std::move(docstring)};
}