aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-03-31 17:18:17 +0300
committerEli Zaretskii2015-03-31 17:18:17 +0300
commitf20a2cd9dcd9f6a62496dc2df7fe5dfc20124bd3 (patch)
treea7edef56ae82d7cd39ac75abdb546224546c6b83 /src
parent5a7380aa271da0b38c387b14328bb5bb902efb01 (diff)
downloademacs-f20a2cd9dcd9f6a62496dc2df7fe5dfc20124bd3.tar.gz
emacs-f20a2cd9dcd9f6a62496dc2df7fe5dfc20124bd3.zip
Avoid crashing with key-chord (Bug#20223)
src/keyboard.c (read_key_sequence): Don't let this_single_command_key_start become negative.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/keyboard.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f0ed9e74745..7c7892a3fe8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12015-03-31 Eli Zaretskii <eliz@gnu.org>
2
3 * keyboard.c (read_key_sequence): Don't let
4 this_single_command_key_start become negative. (Bug#20223)
5
12015-03-29 Jan Djärv <jan.h.d@swipnet.se> 62015-03-29 Jan Djärv <jan.h.d@swipnet.se>
2 7
3 * gtkutil.c (xg_display_open): 8 * gtkutil.c (xg_display_open):
diff --git a/src/keyboard.c b/src/keyboard.c
index bf65df1584c..2d047da5511 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -9591,6 +9591,18 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9591 9591
9592 /* Record what part of this_command_keys is the current key sequence. */ 9592 /* Record what part of this_command_keys is the current key sequence. */
9593 this_single_command_key_start = this_command_key_count - t; 9593 this_single_command_key_start = this_command_key_count - t;
9594 /* When 'input-method-function' called above causes events to be
9595 put on 'unread-post-input-method-events', and as result
9596 'reread' is set to 'true', the value of 't' can become larger
9597 than 'this_command_key_count', because 'add_command_key' is
9598 not called to update 'this_command_key_count'. If this
9599 happens, 'this_single_command_key_start' will become negative
9600 above, and any call to 'this-single-command-keys' will return
9601 a garbled vector. See bug #20223 for one such situation.
9602 Here we force 'this_single_command_key_start' to never become
9603 negative, to avoid that. */
9604 if (this_single_command_key_start < 0)
9605 this_single_command_key_start = 0;
9594 9606
9595 /* Look for this sequence in input-decode-map. 9607 /* Look for this sequence in input-decode-map.
9596 Scan from indec.end until we find a bound suffix. */ 9608 Scan from indec.end until we find a bound suffix. */