Make map_program_segments tend to call abort rather than trash the

stack in unhandled cases.  Still covered by previous ChangeLog entry.
This commit is contained in:
Ian Lance Taylor 1994-05-19 21:58:45 +00:00
parent 7a0c782d39
commit 6731b89c4b

View file

@ -1824,7 +1824,7 @@ map_program_segments (abfd, off, first, phdr_size)
Elf_Internal_Shdr *first;
bfd_size_type phdr_size;
{
Elf_Internal_Phdr phdrs[5];
Elf_Internal_Phdr phdrs[10];
unsigned int phdr_count;
Elf_Internal_Phdr *phdr;
int phdr_size_adjust;
@ -1835,6 +1835,8 @@ map_program_segments (abfd, off, first, phdr_size)
Elf_Internal_Ehdr *i_ehdrp;
BFD_ASSERT ((abfd->flags & EXEC_P) != 0);
BFD_ASSERT (phdr_size / sizeof (Elf_Internal_Phdr)
<= sizeof phdrs / sizeof (phdrs[0]));
phdr_count = 0;
phdr = phdrs;
@ -1996,10 +1998,6 @@ map_program_segments (abfd, off, first, phdr_size)
++phdr_count;
}
/* Make sure we didn't run off our array. */
if (phdr_count > sizeof (phdrs) / sizeof (phdr[0]))
abort ();
/* Make sure the return value from get_program_header_size matches
what we computed here. */
if (phdr_count != phdr_size / sizeof (Elf_Internal_Phdr))