Prevent an out-of-bounds `iq2000_elf_howto_table' table access in
`iq2000_info_to_howto_rela' by using the size of the table rather than
R_IQ2000_max to determine the number of entries in the contiguous
regular IQ2000 relocation range defined and described in the table.
bfd/
* elf32-iq2000.c (iq2000_info_to_howto_rela): Correct the range
check for `iq2000_elf_howto_table' table access.
+2018-04-04 Maciej W. Rozycki <macro@mips.com>
+
+ * elf32-iq2000.c (iq2000_info_to_howto_rela): Correct the range
+ check for `iq2000_elf_howto_table' table access.
+
2018-04-04 Maciej W. Rozycki <macro@mips.com>
* elf32-frv.c (frv_info_to_howto_rela): Correct the range check
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/iq2000.h"
+#include "libiberty.h"
/* Forward declarations. */
break;
default:
- if (r_type >= (unsigned int) R_IQ2000_max)
+ if (r_type >= ARRAY_SIZE (iq2000_elf_howto_table))
{
/* xgettext:c-format */
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),