diff options
author | Nick Clifton <nickc@redhat.com> | 2017-06-14 17:01:54 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-06-14 17:01:54 +0100 |
commit | f461bbd847f15657f3dd2f317c30c75a7520da1f (patch) | |
tree | bcf1f76106ba8b42b0852e17bb062e5157c76903 /bfd/elf32-sh.c | |
parent | ae87f7e73eba29bd38b3a9684a10b948ed715612 (diff) | |
download | fsf-binutils-gdb-f461bbd847f15657f3dd2f317c30c75a7520da1f.zip fsf-binutils-gdb-f461bbd847f15657f3dd2f317c30c75a7520da1f.tar.gz fsf-binutils-gdb-f461bbd847f15657f3dd2f317c30c75a7520da1f.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r-- | bfd/elf32-sh.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 3b1cc67..3df13b5 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -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) |