]> git.eshelyaron.com Git - emacs.git/commitdiff
Don’t use garbage after tty_frame_at returns nil
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 31 Jan 2025 22:42:33 +0000 (14:42 -0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 3 Feb 2025 11:11:56 +0000 (12:11 +0100)
* src/term.c (handle_one_term_event): Don’t access possibly
uninitialized storage if frame is nil.  This fixes an issue introduced
in commit 5eae7f5227c7789dea45cef26fec17c057024670 dated 2025-01-26
14:43:51 -0800. Issue caught by --enable-gcc-warnings, which enables
-Wanalyzer-use-of-uninitialized-value with gcc (GCC) 14.2.1 20250110
(Red Hat 14.2.1-7).

(cherry picked from commit 3a7809f9cc7214e843c20e3c216933bf8bbcdbb2)

src/term.c

index a058cb1f62a4ce3cd520eb7fc390940afbffe48b..f307d70931672884ef70afd7c81bb52d4901dae2 100644 (file)
@@ -2767,8 +2767,8 @@ term_mouse_click (struct input_event *result, Gpm_Event *event,
 int
 handle_one_term_event (struct tty_display_info *tty, const Gpm_Event *event_in)
 {
-  int child_x, child_y;
-  Lisp_Object frame = tty_frame_at (event_in->x, event_in->y, &child_x, &child_y);
+  int child_x = event_in->x, child_y = event_in->y;
+  Lisp_Object frame = tty_frame_at (child_x, child_y, &child_x, &child_y);
   Gpm_Event event = *event_in;
   event.x = child_x;
   event.y = child_y;