From: Paul Eggert Date: Fri, 31 Jan 2025 22:42:33 +0000 (-0800) Subject: Don’t use garbage after tty_frame_at returns nil X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8c608e37f5561ec19597f85b5b51b69c7aedfe16;p=emacs.git Don’t use garbage after tty_frame_at returns nil * 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) --- diff --git a/src/term.c b/src/term.c index a058cb1f62a..f307d709316 100644 --- a/src/term.c +++ b/src/term.c @@ -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;