binutils-gdb/gdb/python
Andrew Burgess 982a38f60b gdb/python: Avoid use after free in py-tui.c
When setting the window title of a tui frame we do this:

  gdb::unique_xmalloc_ptr<char> value
    = python_string_to_host_string (<python-object>);
  ...
  win->window->title = value.get ();

The problem here is that 'get ()' only borrows the pointer from value,
when value goes out of scope the pointer will be freed.  As a result,
the tui frame will be left with a pointer to undefined memory
contents.

Instead we should be using 'value.release ()' to take ownership of the
pointer from value.

gdb/ChangeLog:

	* python/py-tui.c (gdbpy_tui_set_title): Use release, not get, to
	avoid use after free.
2020-06-05 19:21:20 +01:00
..
lib/gdb [gdb/cli] Don't let python colorize strip leading newlines 2020-04-10 09:29:52 +02:00
py-all-events.def
py-arch.c
py-auto-load.c
py-block.c
py-bpevent.c
py-breakpoint.c
py-cmd.c Allow Python commands to be in class_tui 2020-04-28 08:54:17 -06:00
py-continueevent.c
py-event-types.def
py-event.c
py-event.h
py-events.h
py-evtregistry.c
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-frame.c
py-framefilter.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-function.c
py-gdb-readline.c
py-inferior.c Change get_objfile_arch to a method on objfile 2020-04-18 08:35:04 -06:00
py-infevents.c
py-infthread.c
py-instruction.c
py-instruction.h
py-lazy-string.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-linetable.c
py-newobjfileevent.c
py-objfile.c Change get_objfile_arch to a method on objfile 2020-04-18 08:35:04 -06:00
py-param.c
py-prettyprint.c Change extension language pretty-printers to use value API 2020-03-13 18:03:42 -06:00
py-progspace.c
py-record-btrace.c
py-record-btrace.h
py-record-full.c
py-record-full.h
py-record.c
py-record.h
py-ref.h
py-signalevent.c
py-stopevent.c
py-stopevent.h
py-symbol.c
py-symtab.c
py-threadevent.c
py-tui.c gdb/python: Avoid use after free in py-tui.c 2020-06-05 19:21:20 +01:00
py-type.c gdb: remove TYPE_FIELD macro 2020-05-23 17:39:54 -04:00
py-unwind.c
py-utils.c
py-value.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-varobj.c
py-xmethods.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
python-config.py
python-internal.h Change extension language pretty-printers to use value API 2020-03-13 18:03:42 -06:00
python.c Fix Python3.9 related runtime problems 2020-05-28 12:46:16 -07:00
python.h