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 assertion failure in linker triggered by corrupt input file.


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

commit 39d4daf68e696bbf2db417abe677b2e68f3aace9
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Dec 5 12:14:22 2016 +0000

    Fix assertion failure in linker triggered by corrupt input file.
    
    	PR ld/20925
    	* aoutx.h (aout_link_add_symbols): Replace BFD_ASSERT with return
    	FALSE.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/aoutx.h   | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 45b8b88..dbb90e7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-05  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/20925
+	* aoutx.h (aout_link_add_symbols): Replace BFD_ASSERT with return
+	FALSE.
+
 2016-12-03  Alan Modra  <amodra@gmail.com>
 
 	* elf64-ppc.c (struct ppc_link_hash_entry): Delete "was_undefined".
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index b9ac2b7..fb7041a 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -3089,7 +3089,9 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
 	case N_INDR | N_EXT:
 	  /* An indirect symbol.  The next symbol is the symbol
 	     which this one really is.  */
-	  BFD_ASSERT (p + 1 < pend);
+	  /* See PR 20925 for a reproducer.  */
+	  if (p + 1 >= pend)
+	    return FALSE;
 	  ++p;
 	  /* PR 19629: Corrupt binaries can contain illegal string offsets.  */
 	  if (GET_WORD (abfd, p->e_strx) > obj_aout_external_string_size (abfd))


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