Fix address violation bug when disassembling a corrupt SH binary.

PR binutils/21578
	* elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
	flag value.
This commit is contained in:
Nick Clifton 2017-06-14 17:01:54 +01:00
parent ae87f7e73e
commit f461bbd847
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-06-14 Nick Clifton <nickc@redhat.com>
PR binutils/21578
* elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
flag value.
2017-06-14 Nick Clifton <nickc@redhat.com>
PR binutils/21589

View File

@ -6344,7 +6344,7 @@ sh_elf_set_mach_from_flags (bfd *abfd)
{
flagword flags = elf_elfheader (abfd)->e_flags & EF_SH_MACH_MASK;
if (flags >= sizeof(sh_ef_bfd_table))
if (flags >= ARRAY_SIZE (sh_ef_bfd_table))
return FALSE;
if (sh_ef_bfd_table[flags] == 0)