This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix address violation bug when disassembling a corrupt SH binary.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 14 Jun 2017 16:02:23 -0000
- Subject: [binutils-gdb] Fix address violation bug when disassembling a corrupt SH binary.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f461bbd847f15657f3dd2f317c30c75a7520da1f
commit f461bbd847f15657f3dd2f317c30c75a7520da1f
Author: Nick Clifton <nickc@redhat.com>
Date: Wed Jun 14 17:01:54 2017 +0100
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.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf32-sh.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 761514f..b9133d2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
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
* vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
maximum value for the ascic pointer. Check that name processing
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)