PR28346, segfault attempting to disassemble raw binary
authorAlan Modra <amodra@gmail.com>
Fri, 24 Sep 2021 08:21:00 +0000 (17:51 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 25 Sep 2021 01:22:43 +0000 (10:52 +0930)
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.

bfd/elf32-xtensa.c

index 59f3dd55251c0e33fcca47c66b4674a5ebdf741e..e5bfbb2f509994f946cdc9c0b6621b1797bccdaa 100644 (file)
@@ -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))
     {