[binutils-gdb] Don't fill regs window with a negative number of spaces
Hannes Domani
ssbssa@sourceware.org
Sun Feb 7 18:16:44 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3537bc23d960f961d66d36919049c0cc095c8a9c
commit 3537bc23d960f961d66d36919049c0cc095c8a9c
Author: Hannes Domani <ssbssa@yahoo.de>
Date: Tue Jan 5 17:10:15 2021 +0100
Don't fill regs window with a negative number of spaces
Function n_spaces can't handle negative values, and returns an invalid
pointer in this case.
gdb/ChangeLog:
2021-02-07 Hannes Domani <ssbssa@yahoo.de>
* tui/tui-regs.c (tui_data_item_window::rerender): Don't call
n_spaces with a negative value.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/tui/tui-regs.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ce3ebfb6b30..20f3541a634 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-07 Hannes Domani <ssbssa@yahoo.de>
+
+ * tui/tui-regs.c (tui_data_item_window::rerender): Don't call
+ n_spaces with a negative value.
+
2021-02-07 Hannes Domani <ssbssa@yahoo.de>
* tui/tui-regs.c (tui_data_window::display_registers_from):
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 78cb2099746..5caff7195ef 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -492,7 +492,8 @@ tui_data_item_window::rerender (WINDOW *handle, int field_width)
(void) wstandout (handle);
mvwaddnstr (handle, y, x, content.c_str (), field_width - 1);
- waddstr (handle, n_spaces (field_width - content.size ()));
+ if (content.size () < field_width)
+ waddstr (handle, n_spaces (field_width - content.size ()));
if (highlight)
/* We ignore the return value, casting it to void in order to avoid
More information about the Gdb-cvs
mailing list