>From a7478d4768081efe8abc787e250acfd231b738d2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Oct 2019 13:07:49 -0700 Subject: [PATCH 1/2] Fix integer-overflow bug in Time conversion Problem reported by Stefan Monnier (Bug#37795). * src/keyboard.c (make_lispy_position) (make_scroll_bar_position, make_lispy_event): * src/xterm.c (x_ewmh_activate_frame): Use INT_TO_INTEGER to convert Time to a Lisp integer, since the value might not be a fixnum. --- src/keyboard.c | 6 +++--- src/xterm.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index d67d18a801..db583ec530 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5242,7 +5242,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, Fcons (posn, Fcons (Fcons (make_fixnum (xret), make_fixnum (yret)), - Fcons (make_fixnum (t), + Fcons (INT_TO_INTEGER (t), extra_info)))); } @@ -5267,7 +5267,7 @@ toolkit_menubar_in_use (struct frame *f) make_scroll_bar_position (struct input_event *ev, Lisp_Object type) { return list5 (ev->frame_or_window, type, Fcons (ev->x, ev->y), - make_fixnum (ev->timestamp), + INT_TO_INTEGER (ev->timestamp), builtin_lisp_symbol (scroll_bar_parts[ev->part])); } @@ -5579,7 +5579,7 @@ make_lispy_event (struct input_event *event) position = list4 (event->frame_or_window, Qmenu_bar, Fcons (event->x, event->y), - make_fixnum (event->timestamp)); + INT_TO_INTEGER (event->timestamp)); return list2 (item, position); } diff --git a/src/xterm.c b/src/xterm.c index 5d8b1482a6..045589534f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11589,7 +11589,8 @@ x_ewmh_activate_frame (struct frame *f) x_send_client_event (frame, make_fixnum (0), frame, dpyinfo->Xatom_net_active_window, make_fixnum (32), - list2i (1, dpyinfo->last_user_time)); + list2 (make_fixnum (1), + INT_TO_INTEGER (dpyinfo->last_user_time))); } } -- 2.21.0