From f7952c5774671414d9e0e8d3524c2921daa6f28e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 23 Jun 2019 16:07:12 -0600 Subject: [PATCH] Fix latent bug in set_is_exec_point_at valgrind pointed out that the TUI was using uninitialized memory in set_is_exec_point_at. The bug is a missing check against LOA_ADDRESS, causing gdb to examine the uninitialized bits of the "addr" field. gdb/ChangeLog 2019-06-25 Tom Tromey * tui/tui-winsource.c (tui_source_window_base::set_is_exec_point_at): Add check against LOA_ADDRESS. --- gdb/ChangeLog | 6 ++++++ gdb/tui/tui-winsource.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9898bcd5c91..43ed9bca9fa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-06-25 Tom Tromey + + * tui/tui-winsource.c + (tui_source_window_base::set_is_exec_point_at): Add check against + LOA_ADDRESS. + 2019-06-25 Tom Tromey * tui/tui-source.c (tui_set_source_content): Don't check before diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 93c6253fd65..6ec1f1bc0b6 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -365,7 +365,7 @@ tui_source_window_base::set_is_exec_point_at (struct tui_line_or_address l) || content_loa.loa == LOA_ADDRESS); if (content_loa.loa == l.loa && ((l.loa == LOA_LINE && content_loa.u.line_no == l.u.line_no) - || (content_loa.u.addr == l.u.addr))) + || (l.loa == LOA_ADDRESS && content_loa.u.addr == l.u.addr))) new_state = true; else new_state = false; -- 2.30.2