This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Improve objdump's behaviour when it encounters a corrupt binary with an excessively large symbol tab


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=98f02962fefbacf1b805e93fb7bddeb58ec6ff70

commit 98f02962fefbacf1b805e93fb7bddeb58ec6ff70
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jan 9 09:27:46 2017 +0000

    Improve objdump's behaviour when it encounters a corrupt binary with an excessively large symbol table.
    
    	PR binutils/21013
    	* coffgen.c (_bfd_coff_get_external_symbols): Generate an error
    	message if there are too many symbols to load.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/coffgen.c | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f238d86..933feba 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-09  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/21013
+	* coffgen.c (_bfd_coff_get_external_symbols): Generate an error
+	message if there are too many symbols to load.
+
 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
 
 	* elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index d2cc591..5a61f6d 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1643,7 +1643,12 @@ _bfd_coff_get_external_symbols (bfd *abfd)
 
   syms = bfd_malloc (size);
   if (syms == NULL)
-    return FALSE;
+    {
+      /* PR 21013: Provide an error message when the alloc fails.  */
+      _bfd_error_handler (_("%B: Not enough memory to allocate space for %lu symbols"),
+			  abfd, size);
+      return FALSE;
+    }
 
   if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
       || bfd_bread (syms, size, abfd) != size)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]