* PR27858, global-buffer-overflow
@ 2021-05-13 0:51 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2021-05-13 0:51 UTC (permalink / raw)
To: binutils
elf32-sh-relocs.h maxes out before R_SH_max.
PR 27858
* elf32-sh.c (sh_elf_info_to_howto): Correct check for last valid
reloc howto.
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index dae248f50e6..fe2ffc9cb19 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"),
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-18 6:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 0:51 PR27858, global-buffer-overflow Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).