aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-9744.patch
blob: c34a5a6ec956c4266cb5cc284fecfa1dcf1452d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From f461bbd847f15657f3dd2f317c30c75a7520da1f Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 14 Jun 2017 17:01:54 +0100
Subject: [PATCH] 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.

Upstream-Status: Backport
CVE: CVE-2017-9744
Signed-off-by: Armin Kuster <akuster@mvista.com>

---
 bfd/ChangeLog  | 6 ++++++
 bfd/elf32-sh.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

Index: git/bfd/elf32-sh.c
===================================================================
--- git.orig/bfd/elf32-sh.c
+++ git/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)
Index: git/bfd/ChangeLog
===================================================================
--- git.orig/bfd/ChangeLog
+++ git/bfd/ChangeLog
@@ -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-04-29  Alan Modra  <amodra@gmail.com>
 
        PR 21432