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. */) The value is always a vector. */)
(void) (void)
{ {
return Fvector (this_command_key_count ptrdiff_t nkeys = this_command_key_count - this_single_command_key_start;
- this_single_command_key_start, return Fvector (nkeys < 0 ? 0 : nkeys,
(XVECTOR (this_command_keys)->contents (XVECTOR (this_command_keys)->contents
+ this_single_command_key_start)); + this_single_command_key_start));
} }