diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-05-19 21:58:45 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-05-19 21:58:45 +0000 |
commit | 6731b89c4b4854e8e05a43a79be9e24ff38412a6 (patch) | |
tree | 59845a471ac3a1a355cbd573b2cf17bb85147c87 /bfd | |
parent | 7a0c782d39685551734923400942acf62aa85150 (diff) | |
download | gdb-6731b89c4b4854e8e05a43a79be9e24ff38412a6.zip gdb-6731b89c4b4854e8e05a43a79be9e24ff38412a6.tar.gz gdb-6731b89c4b4854e8e05a43a79be9e24ff38412a6.tar.bz2 |
Make map_program_segments tend to call abort rather than trash the
stack in unhandled cases. Still covered by previous ChangeLog entry.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elfcode.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 62114bb..bdedb48 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -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)) |