1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

Avoid crashes under 'which-key-mode'

* src/keyboard.c (Fthis_single_command_keys): Don't allow calls to
Fvector with negative first argument.  (Bug#64857)

(cherry picked from commit 65834b8f8d)
This commit is contained in:
Eli Zaretskii 2023-07-25 20:38:01 +03:00
parent cb1f7db249
commit d13029cdcd

View File

@ -11116,8 +11116,8 @@ the command loop or by `read-key-sequence'.
The value is always a vector. */)
(void)
{
return Fvector (this_command_key_count
- this_single_command_key_start,
ptrdiff_t nkeys = this_command_key_count - this_single_command_key_start;
return Fvector (nkeys < 0 ? 0 : nkeys,
(XVECTOR (this_command_keys)->contents
+ this_single_command_key_start));
}