PR binutils/22875: Visium/ELF: Prevent an out-of-bounds howto table access
[deliverable/binutils-gdb.git] / bfd / elf64-alpha.c
index 734d463509dd431b659484d11ee5173c6b97340b..d59c596adc77c67fb3fb56e30649e484f70ca04f 100644 (file)
@@ -1100,7 +1100,7 @@ elf64_alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 
 /* Given an Alpha ELF reloc type, fill in an arelent structure.  */
 
-static void
+static bfd_boolean
 elf64_alpha_info_to_howto (bfd *abfd, arelent *cache_ptr,
                           Elf_Internal_Rela *dst)
 {
@@ -1112,9 +1112,10 @@ elf64_alpha_info_to_howto (bfd *abfd, arelent *cache_ptr,
       _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
                          abfd, r_type);
       bfd_set_error (bfd_error_bad_value);
-      r_type = R_ALPHA_NONE;
+      return FALSE;
     }
   cache_ptr->howto = &elf64_alpha_howto_table[r_type];
+  return TRUE;
 }
 
 /* These two relocations create a two-word entry in the got.  */
@@ -3211,8 +3212,8 @@ elf64_alpha_relax_with_lituse (struct alpha_relax_info *info,
       _bfd_error_handler
        /* xgettext:c-format */
        (_("%pB: %pA+%#" PRIx64 ": warning: "
-          "LITERAL relocation against unexpected insn"),
-        abfd, info->sec, (uint64_t) irel->r_offset);
+          "%s relocation against unexpected insn"),
+        abfd, info->sec, (uint64_t) irel->r_offset, "LITERAL");
       return TRUE;
     }
 
This page took 0.023919 seconds and 4 git commands to generate.