8sa1-binutils-gdb/gdb/python
Jan Kratochvil c75bd3a239 Fix crash on Python frame filters with unreadable arg
https://bugzilla.redhat.com/show_bug.cgi?id=1126177

ERROR: AddressSanitizer: SEGV on unknown address 0x000000000050 (pc 0x000000992bef sp 0x7ffff9039530 bp 0x7ffff9039540
T0)
    #0 0x992bee in value_type .../gdb/value.c:925
    #1 0x87c951 in py_print_single_arg python/py-framefilter.c:445
    #2 0x87cfae in enumerate_args python/py-framefilter.c:596
    #3 0x87e0b0 in py_print_args python/py-framefilter.c:968

It crashes because frame_arg::val is documented it may contain NULL
(frame_arg::error is then non-NULL) but the code does not handle it.

Another bug is that py_print_single_arg() calls goto out of its TRY_CATCH
which messes up GDB cleanup chain crashing GDB later.

It is probably 7.7 regression (I have not verified it) due to the introduction
of Python frame filters.

gdb/ChangeLog

	PR python/17355
	* python/py-framefilter.c (py_print_single_arg): Handle NULL FA->VAL.
	Fix goto out of TRY_CATCH.

gdb/testsuite/ChangeLog

	PR python/17355
	* gdb.python/amd64-py-framefilter-invalidarg.S: New file.
	* gdb.python/py-framefilter-invalidarg-gdb.py.in: New file.
	* gdb.python/py-framefilter-invalidarg.exp: New file.
	* gdb.python/py-framefilter-invalidarg.py: New file.
2014-09-07 14:09:59 +02:00
..
lib/gdb PR 15276: Add $_caller_is, $_caller_matches, $_any_caller_is, $_any_caller_matches 2014-09-06 09:15:44 -07:00
py-arch.c
py-auto-load.c Include string.h in common-defs.h 2014-08-07 09:06:47 +01:00
py-block.c constify struct block in some places 2014-06-18 08:16:52 -06:00
py-bpevent.c
py-breakpoint.c
py-cmd.c PR python/16699: GDB Python command completion with overriden complete vs. completer class 2014-09-03 16:30:28 -04:00
py-continueevent.c
py-event.c
py-event.h
py-events.h
py-evtregistry.c
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c
py-frame.c Add support for reading frame registers to Python API. 2014-09-03 16:34:47 -07:00
py-framefilter.c Fix crash on Python frame filters with unreadable arg 2014-09-07 14:09:59 +02:00
py-function.c
py-gdb-readline.c Include string.h in common-defs.h 2014-08-07 09:06:47 +01:00
py-inferior.c
py-infthread.c
py-lazy-string.c Include gdb_assert.h in common-defs.h 2014-08-07 09:06:45 +01:00
py-linetable.c
py-newobjfileevent.c
py-objfile.c
py-param.c
py-prettyprint.c
py-progspace.c
py-signalevent.c
py-stopevent.c
py-stopevent.h
py-symbol.c
py-symtab.c constify some blockvector APIs 2014-06-18 08:16:59 -06:00
py-threadevent.c
py-type.c
py-utils.c
py-value.c Include gdb_assert.h in common-defs.h 2014-08-07 09:06:45 +01:00
py-varobj.c Iterate over 'struct varobj_item' instead of PyObject 2014-06-12 15:27:19 +08:00
py-xmethods.c
python-config.py
python-internal.h Move stdio.h to common-defs.h 2014-08-07 09:06:37 +01:00
python.c Move libiberty.h to common-defs.h 2014-08-07 09:06:41 +01:00
python.h