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.
This commit is contained in:
Alan Modra 2018-12-31 15:40:08 +10:30
parent c96e057398
commit 54025d5812
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-12-31 Alan Modra <amodra@gmail.com>
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 <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_relocate_section <tls_ldgd_opt>): When

View File

@ -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)