From 472ebd86277d26e6a7194e0e66fc171439fd8f44 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 29 Aug 2016 17:27:06 +0300 Subject: Avoid crashes for invalid value of key modifiers * src/keyboard.c (parse_solitary_modifier): If the argument SYMBOL is not a symbol, don't try to recognize it. See http://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00502.html for the details. * test/src/keymap-tests.el (keymap-where-is-internal-test): New test, for testing the above fix. --- src/keyboard.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index f27ca0f86e0..e44155260f8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6621,7 +6621,12 @@ has the same base event type and all the specified modifiers. */) int parse_solitary_modifier (Lisp_Object symbol) { - Lisp_Object name = SYMBOL_NAME (symbol); + Lisp_Object name; + + if (!SYMBOLP (symbol)) + return 0; + + name = SYMBOL_NAME (symbol); switch (SREF (name, 0)) { -- cgit v1.2.3