/[packages]/updates/5/binutils/current/SOURCES/binutils-2.25-CVE-2017-6969-part2.patch
ViewVC logotype

Contents of /updates/5/binutils/current/SOURCES/binutils-2.25-CVE-2017-6969-part2.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1188097 - (show annotations) (download)
Sat Dec 30 19:36:51 2017 UTC (6 years, 3 months ago) by luigiwalser
File size: 3947 byte(s)
- add patches from debian to fix several security issues (mga#18987)
- add CVE-2017-6969 and CVE-2017-7210 patches from mga6 package

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

  ViewVC Help
Powered by ViewVC 1.1.30