Fix address violation bug when disassembling a corrupt SH binary.
authorNick Clifton <nickc@redhat.com>
Wed, 14 Jun 2017 16:01:54 +0000 (17:01 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 14 Jun 2017 16:01:54 +0000 (17:01 +0100)
PR binutils/21578
* elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
flag value.

bfd/ChangeLog
bfd/elf32-sh.c

index 761514fe3c4c5bf89f3e1263d7432bc62762a91e..b9133d22ba1ca42e1d4bc90834e954f653440d10 100644 (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
index 3b1cc67ee2625b60ab2f90b3777fd17dffeccb0a..3df13b5a1aac84c6ac7968104cbe6dd21368e88e 100644 (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)
This page took 0.037031 seconds and 4 git commands to generate.