summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-14933_p2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/CVE-2017-14933_p2.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2017-14933_p2.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-14933_p2.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-14933_p2.patch
new file mode 100644
index 0000000000..607d92f3d4
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-14933_p2.patch
@@ -0,0 +1,102 @@
1From 33e0a9a056bd23e923b929a4f2ab049ade0b1c32 Mon Sep 17 00:00:00 2001
2From: Alan Modra <amodra@gmail.com>
3Date: Tue, 26 Sep 2017 23:20:06 +0930
4Subject: [PATCH] Tidy reading data in read_formatted_entries
5
6Using read_attribute_value accomplishes two things: It checks for
7unexpected formats, and ensures the buffer pointer always increments.
8
9 PR 22210
10 * dwarf2.c (read_formatted_entries): Use read_attribute_value to
11 read data.
12
13Upstream-Status: Backport
14Affects: <= 2.29.1
15CVE: CVE-2017-14933 #2
16Signed-off-by: Armin Kuster <akuster@mvista.com>
17
18---
19 bfd/ChangeLog | 6 ++++++
20 bfd/dwarf2.c | 37 +++++++------------------------------
21 2 files changed, 13 insertions(+), 30 deletions(-)
22
23Index: git/bfd/ChangeLog
24===================================================================
25--- git.orig/bfd/ChangeLog
26+++ git/bfd/ChangeLog
27@@ -1,3 +1,9 @@
28+2017-09-26 Alan Modra <amodra@gmail.com>
29+
30+ PR 22210
31+ * dwarf2.c (read_formatted_entries): Use read_attribute_value to
32+ read data.
33+
34 2017-09-26 Nick Clifton <nickc@redhat.com>
35
36 PR 22210
37Index: git/bfd/dwarf2.c
38===================================================================
39--- git.orig/bfd/dwarf2.c
40+++ git/bfd/dwarf2.c
41@@ -1955,6 +1955,7 @@ read_formatted_entries (struct comp_unit
42 char *string_trash;
43 char **stringp = &string_trash;
44 unsigned int uint_trash, *uintp = &uint_trash;
45+ struct attribute attr;
46
47 content_type = _bfd_safe_read_leb128 (abfd, format, &bytes_read,
48 FALSE, buf_end);
49@@ -1986,47 +1987,23 @@ read_formatted_entries (struct comp_unit
50 form = _bfd_safe_read_leb128 (abfd, format, &bytes_read, FALSE,
51 buf_end);
52 format += bytes_read;
53+
54+ buf = read_attribute_value (&attr, form, 0, unit, buf, buf_end);
55+ if (buf == NULL)
56+ return FALSE;
57 switch (form)
58 {
59 case DW_FORM_string:
60- *stringp = read_string (abfd, buf, buf_end, &bytes_read);
61- buf += bytes_read;
62- break;
63-
64 case DW_FORM_line_strp:
65- *stringp = read_indirect_line_string (unit, buf, buf_end, &bytes_read);
66- buf += bytes_read;
67+ *stringp = attr.u.str;
68 break;
69
70 case DW_FORM_data1:
71- *uintp = read_1_byte (abfd, buf, buf_end);
72- buf += 1;
73- break;
74-
75 case DW_FORM_data2:
76- *uintp = read_2_bytes (abfd, buf, buf_end);
77- buf += 2;
78- break;
79-
80 case DW_FORM_data4:
81- *uintp = read_4_bytes (abfd, buf, buf_end);
82- buf += 4;
83- break;
84-
85 case DW_FORM_data8:
86- *uintp = read_8_bytes (abfd, buf, buf_end);
87- buf += 8;
88- break;
89-
90 case DW_FORM_udata:
91- *uintp = _bfd_safe_read_leb128 (abfd, buf, &bytes_read, FALSE,
92- buf_end);
93- buf += bytes_read;
94- break;
95-
96- case DW_FORM_block:
97- /* It is valid only for DW_LNCT_timestamp which is ignored by
98- current GDB. */
99+ *uintp = attr.u.val;
100 break;
101 }
102 }