summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch122
1 files changed, 122 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch
new file mode 100644
index 0000000000..59a5dec675
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch
@@ -0,0 +1,122 @@
1From ef81126314f67472a46db9581530fbf5ccb6b3f2 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Mon, 20 Feb 2017 14:40:39 +0000
4Subject: Fix another memory access error in readelf when
5 parsing a corrupt binary.
6
7 PR binutils/21156
8 * dwarf.c (cu_tu_indexes_read): Move into...
9 (load_cu_tu_indexes): ... here. Change the variable into
10 tri-state. Change the function into boolean, returning
11 false if the indicies could not be loaded.
12 (find_cu_tu_set): Return NULL if the indicies could not be
13 loaded.
14
15CVE: CVE-2017-6969
16Upstream-Status: Backport [master]
17
18Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
19---
20 binutils/ChangeLog | 10 ++++++++++
21 binutils/dwarf.c | 34 ++++++++++++++++++++--------------
22 2 files changed, 30 insertions(+), 14 deletions(-)
23
24diff --git a/binutils/ChangeLog b/binutils/ChangeLog
25index 1d840b42f9..53352c1801 100644
26--- a/binutils/ChangeLog
27+++ b/binutils/ChangeLog
28@@ -1,3 +1,13 @@
29+2017-02-20 Nick Clifton <nickc@redhat.com>
30+
31+ PR binutils/21156
32+ * dwarf.c (cu_tu_indexes_read): Move into...
33+ (load_cu_tu_indexes): ... here. Change the variable into
34+ tri-state. Change the function into boolean, returning
35+ false if the indicies could not be loaded.
36+ (find_cu_tu_set): Return NULL if the indicies could not be
37+ loaded.
38+
39 2017-02-17 Nick Clifton <nickc@redhat.com>
40
41 PR binutils/21156
42diff --git a/binutils/dwarf.c b/binutils/dwarf.c
43index 0184a7ab2e..6d879c9b61 100644
44--- a/binutils/dwarf.c
45+++ b/binutils/dwarf.c
46@@ -76,7 +76,6 @@ int dwarf_check = 0;
47 as a zero-terminated list of section indexes comprising one set of debug
48 sections from a .dwo file. */
49
50-static int cu_tu_indexes_read = 0;
51 static unsigned int *shndx_pool = NULL;
52 static unsigned int shndx_pool_size = 0;
53 static unsigned int shndx_pool_used = 0;
54@@ -99,7 +98,7 @@ static int tu_count = 0;
55 static struct cu_tu_set *cu_sets = NULL;
56 static struct cu_tu_set *tu_sets = NULL;
57
58-static void load_cu_tu_indexes (void *file);
59+static bfd_boolean load_cu_tu_indexes (void *);
60
61 /* Values for do_debug_lines. */
62 #define FLAG_DEBUG_LINES_RAW 1
63@@ -2715,7 +2714,7 @@ load_debug_info (void * file)
64 return num_debug_info_entries;
65
66 /* If this is a DWARF package file, load the CU and TU indexes. */
67- load_cu_tu_indexes (file);
68+ (void) load_cu_tu_indexes (file);
69
70 if (load_debug_section (info, file)
71 && process_debug_info (&debug_displays [info].section, file, abbrev, 1, 0))
72@@ -7378,21 +7377,27 @@ process_cu_tu_index (struct dwarf_section *section, int do_display)
73 section sets that we can use to associate a .debug_info.dwo section
74 with its associated .debug_abbrev.dwo section in a .dwp file. */
75
76-static void
77+static bfd_boolean
78 load_cu_tu_indexes (void *file)
79 {
80+ static int cu_tu_indexes_read = -1; /* Tri-state variable. */
81+
82 /* If we have already loaded (or tried to load) the CU and TU indexes
83 then do not bother to repeat the task. */
84- if (cu_tu_indexes_read)
85- return;
86-
87- if (load_debug_section (dwp_cu_index, file))
88- process_cu_tu_index (&debug_displays [dwp_cu_index].section, 0);
89-
90- if (load_debug_section (dwp_tu_index, file))
91- process_cu_tu_index (&debug_displays [dwp_tu_index].section, 0);
92+ if (cu_tu_indexes_read == -1)
93+ {
94+ cu_tu_indexes_read = TRUE;
95+
96+ if (load_debug_section (dwp_cu_index, file))
97+ if (! process_cu_tu_index (&debug_displays [dwp_cu_index].section, 0))
98+ cu_tu_indexes_read = FALSE;
99+
100+ if (load_debug_section (dwp_tu_index, file))
101+ if (! process_cu_tu_index (&debug_displays [dwp_tu_index].section, 0))
102+ cu_tu_indexes_read = FALSE;
103+ }
104
105- cu_tu_indexes_read = 1;
106+ return (bfd_boolean) cu_tu_indexes_read;
107 }
108
109 /* Find the set of sections that includes section SHNDX. */
110@@ -7402,7 +7407,8 @@ find_cu_tu_set (void *file, unsigned int shndx)
111 {
112 unsigned int i;
113
114- load_cu_tu_indexes (file);
115+ if (! load_cu_tu_indexes (file))
116+ return NULL;
117
118 /* Find SHNDX in the shndx pool. */
119 for (i = 0; i < shndx_pool_used; i++)
120--
1212.11.0
122