summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch
new file mode 100644
index 0000000000..ed5403430c
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch
@@ -0,0 +1,57 @@
1From 1d9a2696903fc59d6a936f4ab4e4407ef329d066 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Fri, 17 Feb 2017 15:59:45 +0000
4Subject: Fix illegal memory accesses in readelf when parsing
5 a corrupt binary.
6
7 PR binutils/21156
8 * readelf.c (find_section_in_set): Test for invalid section
9 indicies.
10
11CVE: CVE-2017-6969
12Upstream-Status: Backport [master]
13
14Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
15---
16 binutils/ChangeLog | 6 ++++++
17 binutils/readelf.c | 10 ++++++++--
18 2 files changed, 14 insertions(+), 2 deletions(-)
19
20diff --git a/binutils/ChangeLog b/binutils/ChangeLog
21index bd63c8a0d8..1d840b42f9 100644
22--- a/binutils/ChangeLog
23+++ b/binutils/ChangeLog
24@@ -1,3 +1,9 @@
25+2017-02-17 Nick Clifton <nickc@redhat.com>
26+
27+ PR binutils/21156
28+ * readelf.c (find_section_in_set): Test for invalid section
29+ indicies.
30+
31 2017-02-13 Nick Clifton <nickc@redhat.com>
32
33 PR binutils/21139
34diff --git a/binutils/readelf.c b/binutils/readelf.c
35index 7c158c6342..4960491c5c 100644
36--- a/binutils/readelf.c
37+++ b/binutils/readelf.c
38@@ -675,8 +675,14 @@ find_section_in_set (const char * name, unsigned int * set)
39 if (set != NULL)
40 {
41 while ((i = *set++) > 0)
42- if (streq (SECTION_NAME (section_headers + i), name))
43- return section_headers + i;
44+ {
45+ /* See PR 21156 for a reproducer. */
46+ if (i >= elf_header.e_shnum)
47+ continue; /* FIXME: Should we issue an error message ? */
48+
49+ if (streq (SECTION_NAME (section_headers + i), name))
50+ return section_headers + i;
51+ }
52 }
53
54 return find_section (name);
55--
562.11.0
57