aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2023-07-25 20:38:01 +0300
committerEli Zaretskii2023-07-30 10:23:05 +0300
commitd13029cdcde22b8e68d91d8f0c0b2649f72675f2 (patch)
treea3624e71b759bd2babbd8398e63dbe1a336cbec9 /src
parentcb1f7db249096bf58e28fb586d7ef926536dcb09 (diff)
downloademacs-d13029cdcde22b8e68d91d8f0c0b2649f72675f2.tar.gz
emacs-d13029cdcde22b8e68d91d8f0c0b2649f72675f2.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c4
1 files changed, 2 insertions, 2 deletions
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'.
11116The value is always a vector. */) 11116The value is always a vector. */)
11117 (void) 11117 (void)
11118{ 11118{
11119 return Fvector (this_command_key_count 11119 ptrdiff_t nkeys = this_command_key_count - this_single_command_key_start;
11120 - this_single_command_key_start, 11120 return Fvector (nkeys < 0 ? 0 : nkeys,
11121 (XVECTOR (this_command_keys)->contents 11121 (XVECTOR (this_command_keys)->contents
11122 + this_single_command_key_start)); 11122 + this_single_command_key_start));
11123} 11123}