aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-09-06 12:24:49 +0100
committerNick Clifton <nickc@redhat.com>2021-09-06 12:25:20 +0100
commit804439b4d7a83d4db8adcb816d8ee8e04a06b33c (patch)
treedd2b701d9b9950ac1cbda06e23ce8f7b4507c38c /bfd
parent1bced5243e82e7a30f415a999c136997d7a79934 (diff)
downloadgdb-804439b4d7a83d4db8adcb816d8ee8e04a06b33c.zip
gdb-804439b4d7a83d4db8adcb816d8ee8e04a06b33c.tar.gz
gdb-804439b4d7a83d4db8adcb816d8ee8e04a06b33c.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf32-score7.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index a6960c0..43cf5cb 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