1 |
commit: b3c5759b316133acdf7fc698df524bb5472b4a7a |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 28 21:06:25 2017 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 28 21:06:36 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3c5759b |
7 |
|
8 |
dev-util/radare2: fix 32-bit overflow in ELF parsing, bug #635618 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/635618 |
11 |
Package-Manager: Portage-2.3.13, Repoman-2.3.4 |
12 |
|
13 |
.../radare2/files/radare2-2.0.1-635618-p1.patch | 29 +++++++++++ |
14 |
.../radare2/files/radare2-2.0.1-635618-p2.patch | 30 +++++++++++ |
15 |
dev-util/radare2/radare2-2.0.1-r1.ebuild | 58 ++++++++++++++++++++++ |
16 |
3 files changed, 117 insertions(+) |
17 |
|
18 |
diff --git a/dev-util/radare2/files/radare2-2.0.1-635618-p1.patch b/dev-util/radare2/files/radare2-2.0.1-635618-p1.patch |
19 |
new file mode 100644 |
20 |
index 00000000000..5644e50cc11 |
21 |
--- /dev/null |
22 |
+++ b/dev-util/radare2/files/radare2-2.0.1-635618-p1.patch |
23 |
@@ -0,0 +1,29 @@ |
24 |
+From c6d0076c924891ad9948a62d89d0bcdaf965f0cd Mon Sep 17 00:00:00 2001 |
25 |
+From: pancake <pancake@×××××××.org> |
26 |
+Date: Wed, 25 Oct 2017 18:00:11 +0200 |
27 |
+Subject: [PATCH] Fix #8731 - Crash in ELF parser with negative 32bit number |
28 |
+ |
29 |
+--- |
30 |
+ libr/bin/format/elf/elf.c | 6 +++++- |
31 |
+ 1 file changed, 5 insertions(+), 1 deletion(-) |
32 |
+ |
33 |
+diff --git a/libr/bin/format/elf/elf.c b/libr/bin/format/elf/elf.c |
34 |
+index 90f6acd30..e3c852fd3 100644 |
35 |
+--- a/libr/bin/format/elf/elf.c |
36 |
++++ b/libr/bin/format/elf/elf.c |
37 |
+@@ -900,7 +900,11 @@ static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) |
38 |
+ free (s); |
39 |
+ } |
40 |
+ sdb_num_set (sdb_version, "cnt", entry->vn_cnt, 0); |
41 |
+- vstart += entry->vn_aux; |
42 |
++ st32 vnaux = entry->vn_aux; |
43 |
++ if (vnaux < 1) { |
44 |
++ goto beach; |
45 |
++ } |
46 |
++ vstart += vnaux; |
47 |
+ for (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) { |
48 |
+ int k; |
49 |
+ Elf_(Vernaux) * aux = NULL; |
50 |
+-- |
51 |
+2.14.3 |
52 |
+ |
53 |
|
54 |
diff --git a/dev-util/radare2/files/radare2-2.0.1-635618-p2.patch b/dev-util/radare2/files/radare2-2.0.1-635618-p2.patch |
55 |
new file mode 100644 |
56 |
index 00000000000..242f4cc6220 |
57 |
--- /dev/null |
58 |
+++ b/dev-util/radare2/files/radare2-2.0.1-635618-p2.patch |
59 |
@@ -0,0 +1,30 @@ |
60 |
+From 44ded3ff35b8264f54b5a900cab32ec489d9e5b9 Mon Sep 17 00:00:00 2001 |
61 |
+From: pancake <pancake@×××××××.org> |
62 |
+Date: Wed, 25 Oct 2017 18:09:24 +0200 |
63 |
+Subject: [PATCH] Fix #8743 - Crash in ELF version parser on 32bit systems |
64 |
+ |
65 |
+--- |
66 |
+ libr/bin/format/elf/elf.c | 7 ++++++- |
67 |
+ 1 file changed, 6 insertions(+), 1 deletion(-) |
68 |
+ |
69 |
+diff --git a/libr/bin/format/elf/elf.c b/libr/bin/format/elf/elf.c |
70 |
+index e3c852fd3..2248731b3 100644 |
71 |
+--- a/libr/bin/format/elf/elf.c |
72 |
++++ b/libr/bin/format/elf/elf.c |
73 |
+@@ -748,7 +748,12 @@ static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) |
74 |
+ verdef->vd_hash = READ32 (dfs, j) |
75 |
+ verdef->vd_aux = READ32 (dfs, j) |
76 |
+ verdef->vd_next = READ32 (dfs, j) |
77 |
+- vstart += verdef->vd_aux; |
78 |
++ int vdaux = verdef->vd_aux; |
79 |
++ if (vdaux < 1) { |
80 |
++ sdb_free (sdb_verdef); |
81 |
++ goto out_error; |
82 |
++ } |
83 |
++ vstart += vdaux; |
84 |
+ if (vstart > end || vstart + sizeof (Elf_(Verdaux)) > end) { |
85 |
+ sdb_free (sdb_verdef); |
86 |
+ goto out_error; |
87 |
+-- |
88 |
+2.14.3 |
89 |
+ |
90 |
|
91 |
diff --git a/dev-util/radare2/radare2-2.0.1-r1.ebuild b/dev-util/radare2/radare2-2.0.1-r1.ebuild |
92 |
new file mode 100644 |
93 |
index 00000000000..78ee0f1268e |
94 |
--- /dev/null |
95 |
+++ b/dev-util/radare2/radare2-2.0.1-r1.ebuild |
96 |
@@ -0,0 +1,58 @@ |
97 |
+# Copyright 1999-2017 Gentoo Foundation |
98 |
+# Distributed under the terms of the GNU General Public License v2 |
99 |
+ |
100 |
+EAPI=6 |
101 |
+ |
102 |
+inherit eutils |
103 |
+ |
104 |
+DESCRIPTION="unix-like reverse engineering framework and commandline tools" |
105 |
+HOMEPAGE="http://www.radare.org" |
106 |
+ |
107 |
+if [[ ${PV} == *9999 ]]; then |
108 |
+ inherit git-r3 |
109 |
+ EGIT_REPO_URI="https://github.com/radare/radare2" |
110 |
+else |
111 |
+ SRC_URI="https://github.com/radare/radare2/archive/${PV}.tar.gz -> ${P}.tar.gz" |
112 |
+ KEYWORDS="~amd64 ~x86 ~arm ~arm64" |
113 |
+fi |
114 |
+ |
115 |
+PATCHES=( |
116 |
+ "${FILESDIR}"/${PN}-0.9.9-nogit.patch |
117 |
+ "${FILESDIR}"/${P}-635618-p1.patch |
118 |
+ "${FILESDIR}"/${P}-635618-p2.patch |
119 |
+) |
120 |
+ |
121 |
+LICENSE="GPL-2" |
122 |
+SLOT="0" |
123 |
+IUSE="ssl +system-capstone zsh-completion" |
124 |
+ |
125 |
+RDEPEND=" |
126 |
+ ssl? ( dev-libs/openssl:0= ) |
127 |
+ system-capstone? ( dev-libs/capstone:0= ) |
128 |
+" |
129 |
+DEPEND="${RDEPEND} |
130 |
+ virtual/pkgconfig |
131 |
+" |
132 |
+ |
133 |
+src_configure() { |
134 |
+ econf \ |
135 |
+ $(use_with ssl openssl) \ |
136 |
+ $(use_with system-capstone syscapstone) |
137 |
+} |
138 |
+ |
139 |
+src_install() { |
140 |
+ default |
141 |
+ |
142 |
+ if use zsh-completion; then |
143 |
+ insinto /usr/share/zsh/site-functions |
144 |
+ doins doc/zsh/_* |
145 |
+ fi |
146 |
+ |
147 |
+ # a workaround for unstable $(INSTALL) call, bug #574866 |
148 |
+ local d |
149 |
+ for d in doc/*; do |
150 |
+ if [[ -d $d ]]; then |
151 |
+ rm -rfv "$d" || die "failed to delete '$d'" |
152 |
+ fi |
153 |
+ done |
154 |
+} |