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.
This commit is contained in:
Hannes Domani
2021-01-05 17:10:15 +01:00
parent 5fc2d6aa06
commit 3537bc23d9
2 changed files with 7 additions and 1 deletions

View File

@ -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> 2021-02-07 Hannes Domani <ssbssa@yahoo.de>
* tui/tui-regs.c (tui_data_window::display_registers_from): * tui/tui-regs.c (tui_data_window::display_registers_from):

View File

@ -492,7 +492,8 @@ tui_data_item_window::rerender (WINDOW *handle, int field_width)
(void) wstandout (handle); (void) wstandout (handle);
mvwaddnstr (handle, y, x, content.c_str (), field_width - 1); 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) if (highlight)
/* We ignore the return value, casting it to void in order to avoid /* We ignore the return value, casting it to void in order to avoid