summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2018-7643.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/CVE-2018-7643.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2018-7643.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2018-7643.patch b/meta/recipes-devtools/binutils/binutils/CVE-2018-7643.patch
new file mode 100644
index 0000000000..2a2dec3a48
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2018-7643.patch
@@ -0,0 +1,102 @@
1From d11ae95ea3403559f052903ab053f43ad7821e37 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Thu, 1 Mar 2018 16:14:08 +0000
4Subject: [PATCH] Prevent illegal memory accesses triggerd by intger overflow
5 when parsing corrupt DWARF information on a 32-bit host.
6
7 PR 22905
8 * dwarf.c (display_debug_ranges): Check that the offset loaded
9 from the range_entry structure is valid.
10
11Upstream-Status: Backport
12Affects: Binutils <= 2.30
13CVE: CVE-2018-7643
14Signed-off-by: Armin Kuster <akuster@mvista.com>
15
16---
17 binutils/ChangeLog | 6 ++++++
18 binutils/dwarf.c | 15 +++++++++++++++
19 2 files changed, 21 insertions(+)
20
21Index: git/binutils/dwarf.c
22===================================================================
23--- git.orig/binutils/dwarf.c
24+++ git/binutils/dwarf.c
25@@ -387,6 +387,9 @@ read_uleb128 (unsigned char * data,
26 } \
27 while (0)
28
29+/* Read AMOUNT bytes from PTR and store them in VAL as an unsigned value.
30+ Checks to make sure that the read will not reach or pass END
31+ and that VAL is big enough to hold AMOUNT bytes. */
32 #define SAFE_BYTE_GET(VAL, PTR, AMOUNT, END) \
33 do \
34 { \
35@@ -415,6 +418,7 @@ read_uleb128 (unsigned char * data,
36 } \
37 while (0)
38
39+/* Like SAFE_BYTE_GET, but also increments PTR by AMOUNT. */
40 #define SAFE_BYTE_GET_AND_INC(VAL, PTR, AMOUNT, END) \
41 do \
42 { \
43@@ -423,6 +427,7 @@ read_uleb128 (unsigned char * data,
44 } \
45 while (0)
46
47+/* Like SAFE_BYTE_GET, but reads a signed value. */
48 #define SAFE_SIGNED_BYTE_GET(VAL, PTR, AMOUNT, END) \
49 do \
50 { \
51@@ -441,6 +446,7 @@ read_uleb128 (unsigned char * data,
52 } \
53 while (0)
54
55+/* Like SAFE_SIGNED_BYTE_GET, but also increments PTR by AMOUNT. */
56 #define SAFE_SIGNED_BYTE_GET_AND_INC(VAL, PTR, AMOUNT, END) \
57 do \
58 { \
59@@ -6543,6 +6549,7 @@ display_debug_ranges_list (unsigned char
60 break;
61 SAFE_SIGNED_BYTE_GET_AND_INC (end, start, pointer_size, finish);
62
63+
64 printf (" %8.8lx ", offset);
65
66 if (begin == 0 && end == 0)
67@@ -6810,6 +6817,13 @@ display_debug_ranges (struct dwarf_secti
68 continue;
69 }
70
71+ if (next < section_begin || next >= finish)
72+ {
73+ warn (_("Corrupt offset (%#8.8lx) in range entry %u\n"),
74+ (unsigned long) offset, i);
75+ continue;
76+ }
77+
78 if (dwarf_check != 0 && i > 0)
79 {
80 if (start < next)
81@@ -6825,6 +6839,7 @@ display_debug_ranges (struct dwarf_secti
82 (unsigned long) (next - section_begin), section->name);
83 }
84 }
85+
86 start = next;
87 last_start = next;
88
89Index: git/bfd/ChangeLog
90===================================================================
91--- git.orig/bfd/ChangeLog
92+++ git/bfd/ChangeLog
93@@ -1,3 +1,9 @@
94+2018-03-01 Nick Clifton <nickc@redhat.com>
95+
96+ PR 22905
97+ * dwarf.c (display_debug_ranges): Check that the offset loaded
98+ from the range_entry structure is valid.
99+
100 2018-05-08 Nick Clifton <nickc@redhat.com>
101
102 PR 22809