[binutils-gdb] Avoid crash with absolute symbol
Tom Tromey
tromey@sourceware.org
Mon Jul 10 17:18:58 GMT 2023
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dd2532ad8af1676450114e4884ad748d528eafbe
commit dd2532ad8af1676450114e4884ad748d528eafbe
Author: Tom Tromey <tom@tromey.com>
Date: Tue Jun 20 15:18:23 2023 -0600
Avoid crash with absolute symbol
A user supplied an executable and a remote logfile that could be used
to crash gdb. The problem is that the BFD section for a particular
symbol was null, because the section was not marked "allocated".
Digging deeper, the problem was that elfread.c dropped the section for
absolute symbols. This patch fixes the crash.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30431
Diff:
---
gdb/elfread.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 799e3b914f8..7697106e9b6 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -216,7 +216,8 @@ record_minimal_symbol (minimal_symbol_reader &reader,
ELF is malformed then this might not be the case. In that case don't
create an msymbol that references an uninitialised section object. */
int section_index = 0;
- if ((bfd_section_flags (bfd_section) & SEC_ALLOC) == SEC_ALLOC)
+ if ((bfd_section_flags (bfd_section) & SEC_ALLOC) == SEC_ALLOC
+ || bfd_section == bfd_abs_section_ptr)
section_index = gdb_bfd_section_index (objfile->obfd.get (), bfd_section);
struct minimal_symbol *result
More information about the Gdb-cvs
mailing list