aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorAdam Lackorzymski <adam@os.inf.tu-dresden.de>2019-06-12 15:05:21 +0100
committerNick Clifton <nickc@redhat.com>2019-06-12 15:05:21 +0100
commit62e0492f5723dd3db5e5a48a3a0ac161d7ba2701 (patch)
treee988843b52c1d20e27e2978ca254fff57c2a73ed /bfd/elf32-arm.c
parent9abca70219e8e15991b9a4d3034672c9f720234f (diff)
downloadgdb-62e0492f5723dd3db5e5a48a3a0ac161d7ba2701.zip
gdb-62e0492f5723dd3db5e5a48a3a0ac161d7ba2701.tar.gz
gdb-62e0492f5723dd3db5e5a48a3a0ac161d7ba2701.tar.bz2
Prevent a seg-fault from objdup when disassembling binaries which do not contain a symbol table.
PR 24643 * elf32-arm.c (arm_elf_find_function): Fail if the symol table is absent, or the bfd is not in the ELF formart. * elfnn-aarch64.c (aarch64_elf_find_function): Likewise.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r--bfd/elf32-arm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index d35d609..52fd48f 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -15983,12 +15983,12 @@ elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
BFD_ARM_SPECIAL_SYM_TYPE_ANY);
}
-/* This is a copy of elf_find_function() from elf.c except that
+/* This is a version of _bfd_elf_find_function() from dwarf2.c except that
ARM mapping symbols are ignored when looking for function names
and STT_ARM_TFUNC is considered to a function type. */
static bfd_boolean
-arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED,
+arm_elf_find_function (bfd * abfd,
asymbol ** symbols,
asection * section,
bfd_vma offset,
@@ -16000,6 +16000,12 @@ arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED,
bfd_vma low_func = 0;
asymbol ** p;
+ if (symbols == NULL)
+ return FALSE;
+
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return FALSE;
+
for (p = symbols; *p != NULL; p++)
{
elf_symbol_type *q;