aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-tui.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-02-08 11:44:51 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-02-08 11:55:05 +0000
commite0c23e11da18b615c382888da8e978f16428e81b (patch)
tree92997a5c1c428d3efa2d645d75a0823903388d09 /gdb/python/py-tui.c
parent1cf2399651ef3fe1350ad8276cf00d16ddeb9960 (diff)
downloadbinutils-e0c23e11da18b615c382888da8e978f16428e81b.zip
binutils-e0c23e11da18b615c382888da8e978f16428e81b.tar.gz
binutils-e0c23e11da18b615c382888da8e978f16428e81b.tar.bz2
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.
Diffstat (limited to 'gdb/python/py-tui.c')
-rw-r--r--gdb/python/py-tui.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index 6e9a146..73b73f3 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -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;