From 65834b8f8d53402517da7fe2446f5bac0aa30c39 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 25 Jul 2023 20:38:01 +0300 Subject: [PATCH] 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) --- src/keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)); } -- 2.39.2