mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 23:23:09 +00:00
PR 33406 SEGV in dump_dwarf_section
Trying to dump .sframe in a PE file results in a segfault accessing elf_section_data. * objdump (dump_sframe_section, dump_dwarf_section): Don't access elf_section_type without first checking the file is ELF.
This commit is contained in:
@@ -4485,7 +4485,8 @@ dump_dwarf_section (bfd *abfd, asection *section,
|
|||||||
else
|
else
|
||||||
match = name;
|
match = name;
|
||||||
|
|
||||||
if (elf_section_type (section) == SHT_GNU_SFRAME)
|
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
|
||||||
|
&& elf_section_type (section) == SHT_GNU_SFRAME)
|
||||||
match = ".sframe";
|
match = ".sframe";
|
||||||
|
|
||||||
for (i = 0; i < max; i++)
|
for (i = 0; i < max; i++)
|
||||||
@@ -4993,9 +4994,10 @@ dump_sframe_section (bfd *abfd, const char *sect_name, bool is_mainfile)
|
|||||||
SHT_GNU_SFRAME. For SFrame sections from Binutils 2.44 or earlier,
|
SHT_GNU_SFRAME. For SFrame sections from Binutils 2.44 or earlier,
|
||||||
check explcitly for SFrame sections of type SHT_PROGBITS and name
|
check explcitly for SFrame sections of type SHT_PROGBITS and name
|
||||||
".sframe" to allow them. */
|
".sframe" to allow them. */
|
||||||
else if (elf_section_type (sec) != SHT_GNU_SFRAME
|
else if (bfd_get_flavour (abfd) != bfd_target_elf_flavour
|
||||||
&& !(elf_section_type (sec) == SHT_PROGBITS
|
|| (elf_section_type (sec) != SHT_GNU_SFRAME
|
||||||
&& strcmp (sect_name, ".sframe") == 0))
|
&& !(elf_section_type (sec) == SHT_PROGBITS
|
||||||
|
&& strcmp (sect_name, ".sframe") == 0)))
|
||||||
{
|
{
|
||||||
printf (_("Section %s does not contain SFrame data\n\n"),
|
printf (_("Section %s does not contain SFrame data\n\n"),
|
||||||
sanitize_string (sect_name));
|
sanitize_string (sect_name));
|
||||||
|
|||||||
Reference in New Issue
Block a user