From: Alan Modra Date: Mon, 31 Dec 2018 05:10:08 +0000 (+1030) Subject: PR24041, Invalid Memory Address Dereference in elf_link_add_object_symbols X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54025d5812ff100f5f0654eb7e1ffd50f2e37f5f;p=binutils-gdb.git PR24041, Invalid Memory Address Dereference in elf_link_add_object_symbols PR 24041 * elflink.c (elf_link_add_object_symbols): Don't segfault on crafted ET_DYN with no program headers. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fbdd0c25b60..370466f1375 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2018-12-31 Alan Modra + + PR 24041 + * elflink.c (elf_link_add_object_symbols): Don't segfault on + crafted ET_DYN with no program headers. + 2018-12-31 Alan Modra * elf64-ppc.c (ppc64_elf_relocate_section ): When diff --git a/bfd/elflink.c b/bfd/elflink.c index f5b411bd628..6e421fb6cdc 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -4186,7 +4186,7 @@ error_free_dyn: all sections contained fully therein. This makes relro shared library sections appear as they will at run-time. */ phdr = elf_tdata (abfd)->phdr + elf_elfheader (abfd)->e_phnum; - while (--phdr >= elf_tdata (abfd)->phdr) + while (phdr-- > elf_tdata (abfd)->phdr) if (phdr->p_type == PT_GNU_RELRO) { for (s = abfd->sections; s != NULL; s = s->next)