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 an assertion failure when parsing a fuzzed x86_64 ELF binary.


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

commit 262c0a877f91b9102fd42523598b46ea79a8970e
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Sep 26 16:03:10 2017 +0100

    Fix an assertion failure when parsing a fuzzed x86_64 ELF binary.
    
    	PR 22172
    	* elf64-x86-64.c (elf_x86_64_info_to_howto): Do not trigger an
    	assertion failure if elf_x86_64_rtype_to_howto has already issued
    	an error message.

Diff:
---
 bfd/ChangeLog      | 7 +++++++
 bfd/elf64-x86-64.c | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0e670cd..20451d7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-26  Nick Clifton  <nickc@redhat.com>
+
+	PR 22172
+	* elf64-x86-64.c (elf_x86_64_info_to_howto): Do not trigger an
+	assertion failure if elf_x86_64_rtype_to_howto has already issued
+	an error message.
+
 2017-09-26  Alan Modra  <amodra@gmail.com>
 
 	PR 22210
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 84a2603..4b19d02 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -344,7 +344,8 @@ elf_x86_64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
       && r_type != (unsigned int) R_X86_64_GNU_VTENTRY)
     r_type &= ~R_X86_64_converted_reloc_bit;
   cache_ptr->howto = elf_x86_64_rtype_to_howto (abfd, r_type);
-  BFD_ASSERT (r_type == cache_ptr->howto->type);
+
+  BFD_ASSERT (r_type == cache_ptr->howto->type || cache_ptr->howto->type == R_X86_64_NONE);
 }
 
 /* Support for core dump NOTE sections.  */


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