PR binutils/22875: Visium/ELF: Prevent an out-of-bounds howto table access
[deliverable/binutils-gdb.git] / bfd / elf32-cris.c
index f47deb0e7b716fedd6993d1b064132410ccb131e..1c367c44cf9b6c8f50f100033da51286c8f72370 100644 (file)
@@ -453,7 +453,7 @@ cris_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
 
 /* Set the howto pointer for an CRIS ELF reloc.  */
 
-static void
+static bfd_boolean
 cris_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED,
                         arelent * cache_ptr,
                         Elf_Internal_Rela * dst)
@@ -466,9 +466,11 @@ cris_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED,
       /* xgettext:c-format */
       _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
                          abfd, r_type);
-      r_type = 0;
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
     }
   cache_ptr->howto = & cris_elf_howto_table [r_type];
+  return TRUE;
 }
 
 bfd_reloc_status_type
This page took 0.024326 seconds and 4 git commands to generate.