From: Eli Zaretskii Date: Tue, 25 Jul 2023 17:38:01 +0000 (+0300) Subject: Avoid crashes under 'which-key-mode' X-Git-Tag: archive/raspbian/1%30.1+1-3+rpi1^2~2^2~20^2~4901 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=65834b8f8d53402517da7fe2446f5bac0aa30c39;p=emacs.git 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) --- diff --git a/src/keyboard.c b/src/keyboard.c index 41cda2e65de..2e850b74b9b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11138,8 +11138,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)); }