[binutils-gdb] Fix an illegal memory access triggered by disassembling corrupt s390x binaries.

Nick Clifton nickc@sourceware.org
Mon Sep 6 11:26:42 GMT 2021


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

commit 804439b4d7a83d4db8adcb816d8ee8e04a06b33c
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Sep 6 12:24:49 2021 +0100

    Fix an illegal memory access triggered by disassembling corrupt s390x binaries.
    
            PR 28304
            * elfxx-score7.c (score_elf_gprel15_reloc): If there is no output bfd
            treat the reloc as undefined.

Diff:
---
 bfd/elf32-score7.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index a6960c02c50..43cf5cb70cd 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -441,6 +441,8 @@ score_elf_gprel15_reloc (bfd *abfd,
     {
       relocateable = false;
       output_bfd = symbol->section->output_section->owner;
+      if (output_bfd == NULL)
+	return bfd_reloc_undefined;
     }
 
   ret = score_elf_final_gp (output_bfd, symbol, relocateable, error_message, &gp);
@@ -448,7 +450,7 @@ score_elf_gprel15_reloc (bfd *abfd,
     return ret;
 
   return score_elf_gprel15_with_gp (abfd, symbol, reloc_entry,
-					 input_section, relocateable, data, gp);
+				    input_section, relocateable, data, gp);
 }
 
 /* Do a R_SCORE_GPREL32 relocation.  This is a 32 bit value which must


More information about the Binutils-cvs mailing list