diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/source-cache.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e294fdc..6885af0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-03-25 Simon Marchi <simon.marchi@polymtl.ca> + + * source-cache.c (source_cache::get_source_lines): Re-read + fullname after calling open_source_file. + 2019-03-25 John Baldwin <jhb@FreeBSD.org> * NEWS: Mention TLS support for FreeBSD. diff --git a/gdb/source-cache.c b/gdb/source-cache.c index 9211f09..5eae020 100644 --- a/gdb/source-cache.c +++ b/gdb/source-cache.c @@ -206,6 +206,12 @@ source_cache::get_source_lines (struct symtab *s, int first_line, if (desc.get () < 0) return false; find_source_lines (s, desc.get ()); + + /* FULLNAME points to a value owned by the symtab + (symtab::fullname). Calling open_source_file reallocates + that value, so we must refresh FULLNAME to avoid a + use-after-free. */ + fullname = symtab_to_fullname (s); } srchilite::SourceHighlight highlighter ("esc.outlang"); highlighter.setStyleFile("esc.style"); |