Fix memory access violations triggered by running dlltool on corrupt binaries.
authorNick Clifton <nickc@redhat.com>
Tue, 27 Jan 2015 11:30:15 +0000 (11:30 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 27 Jan 2015 11:30:15 +0000 (11:30 +0000)
PR binutils/17512
* dlltool.c (identify_search_archive): If the last archive was the
same as the current archive, terminate the loop.

* pdp11.c (aout_get_external_symbols): Return false if there are
no symbols.

bfd/ChangeLog
bfd/pdp11.c
binutils/ChangeLog
binutils/dlltool.c

index f2e3ddbbf91704a9ff95a2deff4a174c20052919..1b142971a48ff236ba0d676586654ad20055d237 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-27  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/17512
+       * pdp11.c (aout_get_external_symbols): Return false if there are
+       no symbols.
+
 2015-01-26  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
 
        * elf32-nds32.c (nds32_elf_pick_relax): Fix again setting.
index c559bee91e04c27ffabed5b17354d0f499c78a7b..420c9c3d074ca609163674a54b0a9b64430445a0 100644 (file)
@@ -1189,6 +1189,9 @@ aout_get_external_symbols (bfd *abfd)
 
       count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
 
+      /* PR 17512: file: 011f5a08.  */
+      if (count == 0)
+       return FALSE;
 #ifdef USE_MMAP
       if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
                                 exec_hdr (abfd)->a_syms,
index 5fbccc8ed3579431efc55724ee281db6e0d29dab..a017c64829bf2d250b13fc72a1a2ba659cc649a3 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-27  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/17512
+       * dlltool.c (identify_search_archive): If the last archive was the
+       same as the current archive, terminate the loop.
+
 2015-01-23  Nick Clifton  <nickc@redhat.com>
 
        * nlmconv.c (powerpc_mangle_relocs): Fix build errors introduced
index dcc46518b5321a10f0596fdf6f550a2dcfcbc427..b5b3affac1f135f00014208699e204f92725ba0c 100644 (file)
@@ -3589,7 +3589,15 @@ identify_search_archive (bfd * abfd,
         }
 
       if (last_arfile != NULL)
-       bfd_close (last_arfile);
+       {
+         bfd_close (last_arfile);
+         /* PR 17512: file: 8b2168d4.  */
+         if (last_arfile == arfile)
+           {
+             last_arfile = NULL;
+             break;
+           }
+       }
 
       last_arfile = arfile;
     }