aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-sh.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-05-13 10:11:20 +0930
committerAlan Modra <amodra@gmail.com>2021-05-13 10:18:44 +0930
commit4863cddb5079ce34007c5bebc0315b8eddb9ef6d (patch)
tree63d613dbabe400d4b7794b497861f74657047a28 /bfd/elf32-sh.c
parent3e5fac07975a310c90772e59c17955b4137cc49b (diff)
downloadgdb-4863cddb5079ce34007c5bebc0315b8eddb9ef6d.zip
gdb-4863cddb5079ce34007c5bebc0315b8eddb9ef6d.tar.gz
gdb-4863cddb5079ce34007c5bebc0315b8eddb9ef6d.tar.bz2
PR27858, global-buffer-overflow
PR 27858 * elf32-sh.c (sh_elf_info_to_howto): Correct check for last valid reloc howto.
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r--bfd/elf32-sh.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index dae248f..fe2ffc9 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -426,13 +426,12 @@ sh_elf_info_to_howto (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
r = ELF32_R_TYPE (dst->r_info);
- if (r >= R_SH_max
+ if (r >= R_SH_FIRST_INVALID_RELOC_6
|| (r >= R_SH_FIRST_INVALID_RELOC && r <= R_SH_LAST_INVALID_RELOC)
|| (r >= R_SH_FIRST_INVALID_RELOC_2 && r <= R_SH_LAST_INVALID_RELOC_2)
|| (r >= R_SH_FIRST_INVALID_RELOC_3 && r <= R_SH_LAST_INVALID_RELOC_3)
|| (r >= R_SH_FIRST_INVALID_RELOC_4 && r <= R_SH_LAST_INVALID_RELOC_4)
- || (r >= R_SH_FIRST_INVALID_RELOC_5 && r <= R_SH_LAST_INVALID_RELOC_5)
- || (r >= R_SH_FIRST_INVALID_RELOC_6 && r <= R_SH_LAST_INVALID_RELOC_6))
+ || (r >= R_SH_FIRST_INVALID_RELOC_5 && r <= R_SH_LAST_INVALID_RELOC_5))
{
/* xgettext:c-format */
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),