emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 296dadb: Avoid crashes when key-binding is called f


From: Eli Zaretskii
Subject: [Emacs-diffs] master 296dadb: Avoid crashes when key-binding is called from a timer
Date: Mon, 08 Jun 2015 14:40:40 +0000

branch: master
commit 296dadb14e19926de1fc5e0015cb8d4f10f9547a
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid crashes when key-binding is called from a timer
    
    * src/keymap.c (Fkey_binding): Don't segfault if called with an
    empty vector as KEY.  (Bug#20705)
---
 src/keymap.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/keymap.c b/src/keymap.c
index 8f4ac0d..b69b409 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1652,10 +1652,14 @@ specified buffer position instead of point are used.
 
   if (NILP (position) && VECTORP (key))
     {
-      Lisp_Object event
-       /* mouse events may have a symbolic prefix indicating the
-          scrollbar or mode line */
-       = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
+      Lisp_Object event;
+
+      if (ASIZE (key) == 0)
+       return Qnil;
+
+      /* mouse events may have a symbolic prefix indicating the
+        scrollbar or mode line */
+      event = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
 
       /* We are not interested in locations without event data */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]