aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-03-18 09:32:09 -0600
committerTom Tromey <tromey@adacore.com>2019-03-18 09:56:27 -0600
commit4bd56d18cc9799f283715a96ba61fd4b958b2f71 (patch)
treeb1c1e25361965fffc8cfa5d9cda69215168ecce1 /gdb
parent55c10aca2e93cc7a4301aa1635ef9d6d73a804b1 (diff)
downloadgdb-4bd56d18cc9799f283715a96ba61fd4b958b2f71.zip
gdb-4bd56d18cc9799f283715a96ba61fd4b958b2f71.tar.gz
gdb-4bd56d18cc9799f283715a96ba61fd4b958b2f71.tar.bz2
Fix regression caused by minimal symbol changes
The earlier patch to change minimal symbol allocations to use xmalloc erroneously left a call to obstack_blank in minimal_symbol_reader::install. Because obstack_blank does not finish the object allocation on an obstack, this in turn could cause invalid memory reads in some situations. This patch fixes the problem by removing the call. Tested on x86-64 Fedora 29; also verified with valgrind. gdb/ChangeLog 2019-03-18 Tom Tromey <tromey@adacore.com> * minsyms.c (minimal_symbol_reader::install): Remove call to obstack_blank.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/minsyms.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d23819d..b224ebd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-18 Tom Tromey <tromey@adacore.com>
+
+ * minsyms.c (minimal_symbol_reader::install): Remove call to
+ obstack_blank.
+
2019-03-18 Pedro Alves <palves@redhat.com>
* tui/tui-io.c (reverse_mode_p, reverse_save_bg, reverse_save_fg):
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index fe2ad94..b95e9ef 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1360,8 +1360,6 @@ minimal_symbol_reader::install ()
we will give back the excess space. */
alloc_count = m_msym_count + m_objfile->per_bfd->minimal_symbol_count;
- obstack_blank (&m_objfile->per_bfd->storage_obstack,
- alloc_count * sizeof (struct minimal_symbol));
gdb::unique_xmalloc_ptr<minimal_symbol>
msym_holder (XNEWVEC (minimal_symbol, alloc_count));
msymbols = msym_holder.get ();