diff options
author | Nick Clifton <nickc@redhat.com> | 2016-12-02 17:46:26 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-12-02 17:47:07 +0000 |
commit | d7f399a8de4c55eb841db6493597a587fac002de (patch) | |
tree | d0ffd98c9c5daa211641537363706d18ba6391c9 /bfd/elflink.c | |
parent | 008459ea88ad4fdcb7da37dad7f68888ef6ecc47 (diff) | |
download | gdb-d7f399a8de4c55eb841db6493597a587fac002de.zip gdb-d7f399a8de4c55eb841db6493597a587fac002de.tar.gz gdb-d7f399a8de4c55eb841db6493597a587fac002de.tar.bz2 |
Fix seg-fault in linker when passed a corrupt binary input file.
PR lf/20908
* elflink.c (bfd_elf_final_link): Check for ELF flavour binaries
when following indirect links.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 5f87f87..320f3be 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -11342,6 +11342,12 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) asection *sec; sec = p->u.indirect.section; + /* See PR 20908 for a reproducer. */ + if (bfd_get_flavour (sec->owner) != bfd_target_elf_flavour) + { + _bfd_error_handler (_("%B: not in ELF format"), sec->owner); + goto error_return; + } esdi = elf_section_data (sec); /* Mark all sections which are to be included in the |