Fix problem with linker created sections being mistakenly flagged
authorNick Clifton <nickc@redhat.com>
Tue, 4 Nov 2014 16:00:10 +0000 (16:00 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 4 Nov 2014 16:00:10 +0000 (16:00 +0000)
as corrupt by the new error checking code in bfd_get_full_section_contents.

PR binutils/17512
* compress.c (bfd_get_full_section_contents): Improve test for
linker created objects.

bfd/ChangeLog
bfd/compress.c

index 8c3669b48a90f97ecaf1276a09367712e92efc6d..5c2445c63bd644c5f71ff923db0aca4136235b89 100644 (file)
@@ -1,5 +1,9 @@
 2014-11-04  Nick Clifton  <nickc@redhat.com>
 
+       PR binutils/17512
+       * compress.c (bfd_get_full_section_contents): Improve test for
+       linker created objects.
+
        PR binutils/17533
        * archive.c (_bfd_slurp_extended_name_table): Handle archives with
        corrupt extended name tables.
index 083a7df1c938492b480e18f712005687c1c23461..683156209a75e9b121fe81276ac6b10b8046979d 100644 (file)
@@ -179,8 +179,9 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
     case COMPRESS_SECTION_NONE:
       /* PR binutils/17512: Avoid malloc or file reading errors due to
         ridiculous section sizes.  But ignore linker created objects
-        with no contents (yet).  */
+        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;