mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-28 06:03:00 +08:00
gdb/python: don't allow the user to delete window title attributes
There's a bug in the python tui API. If the user tries to delete the window title attribute then this will trigger undefined behaviour in GDB due to a missing nullptr check. gdb/ChangeLog: * python/py-tui.c (gdbpy_tui_set_title): Check that the new value for the title is not nullptr. gdb/testsuite/ChangeLog: * gdb.python/tui-window.exp: Add new tests. * gdb.python/tui-window.py (TestWindow) <__init__>: Store TestWindow object into global the_window. <remote_title>: New method. (delete_window_title): New function.
This commit is contained in:
@ -434,7 +434,7 @@ gdbpy_tui_set_title (PyObject *self, PyObject *newvalue, void *closure)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (win->window == nullptr)
|
||||
if (newvalue == nullptr)
|
||||
{
|
||||
PyErr_Format (PyExc_TypeError, _("Cannot delete \"title\" attribute."));
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user