Revert changes in previous deltas that introduced new failures into
authorNick Clifton <nickc@redhat.com>
Thu, 6 Nov 2014 14:39:58 +0000 (14:39 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 6 Nov 2014 14:39:58 +0000 (14:39 +0000)
the linker testsuite.

* aoutx.h (slurp_symbol_table): Revert previous delta.
(slurp_reloc_table): Likewise.
* compress.c (bfd_get_full_section_contents): Remove file size
test.
* coffgen.c (coff_get_normalized_symtab): Allow zero-sized symtabs
and do not complain about linker generated files.

bfd/ChangeLog
bfd/aoutx.h
bfd/coffgen.c
bfd/compress.c

index 7a57b1265f99207e6e5423728566b62472b792e9..97057d46dc0cc0c78e4bb86b341eff6b44aaaa42 100644 (file)
@@ -1,3 +1,12 @@
+2014-11-06  Nick Clifton  <nickc@redhat.com>
+
+       * aoutx.h (slurp_symbol_table): Revert previous delta.
+       (slurp_reloc_table): Likewise.
+       * compress.c (bfd_get_full_section_contents): Remove file size
+       test.
+       * coffgen.c (coff_get_normalized_symtab): Allow zero-sized symtabs
+       and do not complain about linker generated files.
+
 2014-11-06  Will Newton  <will.newton@linaro.org>
 
        * elf-attrs.c (_bfd_elf_parse_attributes): Handle zero
index cb0887a4bacb349dec9bbf8c2cdf61dd4d3c2b0d..bef59b423667fab30cf26666391de17e08149d12 100644 (file)
@@ -1756,8 +1756,6 @@ NAME (aout, slurp_symbol_table) (bfd *abfd)
     return TRUE;               /* Nothing to do.  */
 
   cached_size *= sizeof (aout_symbol_type);
-  if (cached_size >= (bfd_size_type) bfd_get_size (abfd))
-    return FALSE;
   cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
   if (cached == NULL)
     return FALSE;
@@ -2309,11 +2307,6 @@ NAME (aout, slurp_reloc_table) (bfd *abfd, sec_ptr asect, asymbol **symbols)
   if (reloc_size == 0)
     return TRUE;               /* Nothing to be done.  */
 
-  /* PR binutils/17512: Do not even try to
-     load the relocs if their size is corrupt.  */
-  if (reloc_size + asect->rel_filepos >= (bfd_size_type) bfd_get_size (abfd))
-    return FALSE;
-
   if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
     return FALSE;
 
index d0bf2c1a181a9ea6877063d4155ed07f563277fe..4856a40e5e72e3d227099d090366bdbe5648d961 100644 (file)
@@ -1622,7 +1622,10 @@ _bfd_coff_get_external_symbols (bfd *abfd)
   /* PR binutils/17512: Do not even try to load
      a symbol table bigger than the entire file...  */
   if (size >= (bfd_size_type) bfd_get_size (abfd))
+    {
+      fprintf (stderr, "XXX SIZE FAIL 1\n");
     return FALSE;
+    }
 
   syms = bfd_malloc (size);
   if (syms == NULL)
@@ -1757,11 +1760,12 @@ coff_get_normalized_symtab (bfd *abfd)
     return obj_raw_syments (abfd);
 
   size = obj_raw_syment_count (abfd);
-  if (size == 0)
-    return NULL;
   /* PR binutils/17512: Do not even try to load
-     a symbol table bigger than the entire file...  */
-  if (size >= (bfd_size_type) bfd_get_size (abfd))
+     a symbol table bigger than the entire file...
+     Note - we do not fail on a size of 0.  Linker created
+     bfds can have this property and they are not corrupt.  */
+  if (size >= (bfd_size_type) bfd_get_size (abfd)
+      && bfd_get_size (abfd) > 0)
     return NULL;
 
   size *= sizeof (combined_entry_type);
index 683156209a75e9b121fe81276ac6b10b8046979d..20eef9528265e905e9b7220e38520625cfb15dea 100644 (file)
@@ -177,14 +177,6 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
   switch (sec->compress_status)
     {
     case COMPRESS_SECTION_NONE:
-      /* PR binutils/17512: Avoid malloc or file reading errors due to
-        ridiculous section sizes.  But ignore linker created objects
-        and bfds with no contents (yet).  */
-      if (bfd_get_size (abfd) > 0
-         && (sec->flags & SEC_LINKER_CREATED) == 0
-         && sz > (bfd_size_type) bfd_get_size (abfd))
-       return FALSE;
-
       if (p == NULL)
        {
          p = (bfd_byte *) bfd_malloc (sz);
This page took 0.037662 seconds and 4 git commands to generate.