From: Eli Zaretskii Date: Tue, 25 Jul 2023 17:38:01 +0000 (+0300) Subject: Avoid crashes under 'which-key-mode' X-Git-Tag: emacs-29.1.90~277^2~9 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d13029cdcde22b8e68d91d8f0c0b2649f72675f2;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) (cherry picked from commit 65834b8f8d53402517da7fe2446f5bac0aa30c39) --- diff --git a/src/keyboard.c b/src/keyboard.c index 99f886821e2..101a6f3a78e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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)); }