PR27858, global-buffer-overflow
authorAlan Modra <amodra@gmail.com>
Thu, 13 May 2021 00:41:20 +0000 (10:11 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 13 May 2021 00:48:44 +0000 (10:18 +0930)
PR 27858
* elf32-sh.c (sh_elf_info_to_howto): Correct check for last valid
reloc howto.

bfd/ChangeLog
bfd/elf32-sh.c

index 0e4ccd8d0a0b20a704d742b361f5db3dfb2e9524..fcb692bdb3553d84fa4eee0db82b2151100f3e4f 100644 (file)
@@ -1,3 +1,9 @@
+2021-05-13  Alan Modra  <amodra@gmail.com>
+
+       PR 27858
+       * elf32-sh.c (sh_elf_info_to_howto): Correct check for last valid
+       reloc howto.
+
 2021-05-12  Luis Machado  <luis.machado@linaro.org>
 
        * elf-bfd.h (elfcore_write_aarch_mte): New prototype.
index dae248f50e65ba20d07bc50c9a8b96000a82b442..fe2ffc9cb193984b8b4f5d66c38208a1a3ea3ccd 100644 (file)
@@ -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"),