aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-xtensa.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-09-24 17:51:00 +0930
committerAlan Modra <amodra@gmail.com>2021-09-25 10:52:43 +0930
commit99d0d99649c12b2bdccaeb788d5d0f0d0dff4d5d (patch)
tree015d4c715bacec132eb64eacb30a42ab97a0a81d /bfd/elf32-xtensa.c
parentef7639ccb7a739326ed2b872afdd9b701404cad8 (diff)
downloadgdb-99d0d99649c12b2bdccaeb788d5d0f0d0dff4d5d.zip
gdb-99d0d99649c12b2bdccaeb788d5d0f0d0dff4d5d.tar.gz
gdb-99d0d99649c12b2bdccaeb788d5d0f0d0dff4d5d.tar.bz2
PR28346, segfault attempting to disassemble raw binary
Don't attempt to access elf_section_data for non-ELF sections. PR 28346 * elf32-xtensa.c (xtensa_read_table_entries): Return zero entries for non-ELF.
Diffstat (limited to 'bfd/elf32-xtensa.c')
-rw-r--r--bfd/elf32-xtensa.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 59f3dd5..e5bfbb2 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -885,7 +885,8 @@ xtensa_read_table_entries (bfd *abfd,
flagword predef_flags;
bfd_size_type table_entry_size, section_limit;
- if (!section
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour
+ || !section
|| !(section->flags & SEC_ALLOC)
|| (section->flags & SEC_DEBUGGING))
{