From 063bb0250defafcc55544474a2961ecbc153882e Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 8 Jan 2015 15:39:49 +0000 Subject: 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. --- bfd/coffcode.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bfd/coffcode.h') diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 695497f4b3..9e1c20acf3 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -5012,13 +5012,13 @@ coff_slurp_symbol_table (bfd * abfd) #if defined(TIC80COFF) || defined(TICOFF) case C_UEXT: /* Tentative external definition. */ #endif - case C_EXTLAB: /* External load time label. */ - case C_HIDDEN: /* Ext symbol in dmert public lib. */ default: (*_bfd_error_handler) (_("%B: Unrecognized storage class %d for %s symbol `%s'"), abfd, src->u.syment.n_sclass, dst->symbol.section->name, dst->symbol.name); + case C_EXTLAB: /* External load time label. */ + case C_HIDDEN: /* Ext symbol in dmert public lib. */ dst->symbol.flags = BSF_DEBUGGING; dst->symbol.value = (src->u.syment.n_value); break; @@ -5046,7 +5046,8 @@ coff_slurp_symbol_table (bfd * abfd) p = abfd->sections; while (p) { - coff_slurp_line_table (abfd, p); + if (! coff_slurp_line_table (abfd, p)) + return FALSE; p = p->next; } } -- cgit v1.2.3