Improve objdump's behaviour when it encounters a corrupt binary with an excessively...
authorNick Clifton <nickc@redhat.com>
Mon, 9 Jan 2017 09:27:46 +0000 (09:27 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 9 Jan 2017 09:27:46 +0000 (09:27 +0000)
PR binutils/21013
* coffgen.c (_bfd_coff_get_external_symbols): Generate an error
message if there are too many symbols to load.

bfd/ChangeLog
bfd/coffgen.c

index f238d8647176927372d375af24783f1c9c8a5992..933feba0bd4fd18344f6c3b81e573d7f0b1d450d 100644 (file)
@@ -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
index d2cc59184909df965cf22d9bcf38832410c0b798..5a61f6dc0d20dcc7d04ceca1b68dc7a9c4023632 100644 (file)
@@ -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)