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] Fix memory access violations triggered by running dlltool on corrupt binaries.


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

commit 37e3922eed415bbedd2dd6e46308fe9e03417770
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Jan 27 11:30:15 2015 +0000

    Fix memory access violations triggered by running dlltool on corrupt binaries.
    
    	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.

Diff:
---
 bfd/ChangeLog      |  6 ++++++
 bfd/pdp11.c        |  3 +++
 binutils/ChangeLog |  6 ++++++
 binutils/dlltool.c | 10 +++++++++-
 4 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f2e3ddb..1b14297 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index c559bee..420c9c3 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -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,
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 5fbccc8..a017c64 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index dcc4651..b5b3aff 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -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;
     }


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