aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-01-08 15:39:49 +0000
committerNick Clifton <nickc@redhat.com>2015-01-08 15:39:49 +0000
commit063bb0250defafcc55544474a2961ecbc153882e (patch)
tree5ec4e53c3bbc11fc7ff8dce67ccfacaad5608767 /bfd/elf.c
parent848cde35d61874521ad6c88a50f983d5ee7d2307 (diff)
downloadgdb-063bb0250defafcc55544474a2961ecbc153882e.zip
gdb-063bb0250defafcc55544474a2961ecbc153882e.tar.gz
gdb-063bb0250defafcc55544474a2961ecbc153882e.tar.bz2
Fix memory access violations exposed by running strip on fuzzed binaries.
PR binutils/17512 * coffcode.h (coff_slurp_symbol_table): Return false if we failed to load the line table. * elf.c (_bfd_elf_map_sections_to_segments): Enforce a minimum maxpagesize of 1. * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the Data Directory Size is too large. * objcopy.c (copy_object): Free the symbol table if no symbols could be loaded. (copy_file): Use bfd_close_all_done to close files that could not be copied.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index f262cc3..0aa5f8e 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4011,6 +4011,11 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
last_size = 0;
phdr_index = 0;
maxpagesize = bed->maxpagesize;
+ /* PR 17512: file: c8455299.
+ Avoid divide-by-zero errors later on.
+ FIXME: Should we abort if the maxpagesize is zero ? */
+ if (maxpagesize == 0)
+ maxpagesize = 1;
writable = FALSE;
dynsec = bfd_get_section_by_name (abfd, ".dynamic");
if (dynsec != NULL