Merge remote-tracking branch 'krobelus/fix-remap-uaf'
This commit is contained in:
commit
96ff68aeae
|
@ -13,6 +13,9 @@ namespace Kakoune
|
||||||
void KeymapManager::map_key(Key key, KeymapMode mode,
|
void KeymapManager::map_key(Key key, KeymapMode mode,
|
||||||
KeyList mapping, String docstring)
|
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)};
|
m_mapping[KeyAndMode{key, mode}] = {std::move(mapping), std::move(docstring)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
test/regression/4896-remap-executing-mapping/cmd
Normal file
3
test/regression/4896-remap-executing-mapping/cmd
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
!printf $kak_opt_source_count<ret>l
|
||||||
|
<space>s
|
||||||
|
!printf $kak_opt_source_count<ret>
|
1
test/regression/4896-remap-executing-mapping/in
Normal file
1
test/regression/4896-remap-executing-mapping/in
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
test/regression/4896-remap-executing-mapping/out
Normal file
1
test/regression/4896-remap-executing-mapping/out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
12
|
3
test/regression/4896-remap-executing-mapping/rc
Normal file
3
test/regression/4896-remap-executing-mapping/rc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
try %{ map global user s %exp{:source %%{%val{source}}<ret>} -docstring "re-source my kakrc" }
|
||||||
|
declare-option int source_count
|
||||||
|
set-option -add global source_count 1
|
Loading…
Reference in New Issue
Block a user