1 |
commit: 6ab1a068d867bd08ed5377a7b5a8d9e3ec046b18 |
2 |
Author: Andrew Savchenko <bircoph <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Mar 1 20:03:46 2020 +0000 |
4 |
Commit: Andrew Savchenko <bircoph <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Mar 1 20:06:21 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ab1a068 |
7 |
|
8 |
app-text/xpdf: fix CVE-2019-17064 |
9 |
|
10 |
Fix NULL pointer dereference by initializing field before use. |
11 |
https://forum.xpdfreader.com/viewtopic.php?f=3&t=41890#p42672 |
12 |
|
13 |
Bug: https://bugs.gentoo.org/711146 |
14 |
Package-Manager: Portage-2.3.82, Repoman-2.3.20 |
15 |
Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org> |
16 |
|
17 |
app-text/xpdf/files/xpdf-CVE-2019-17064.patch | 24 +++++ |
18 |
app-text/xpdf/xpdf-4.02-r2.ebuild | 141 ++++++++++++++++++++++++++ |
19 |
2 files changed, 165 insertions(+) |
20 |
|
21 |
diff --git a/app-text/xpdf/files/xpdf-CVE-2019-17064.patch b/app-text/xpdf/files/xpdf-CVE-2019-17064.patch |
22 |
new file mode 100644 |
23 |
index 00000000000..c4f84a4604c |
24 |
--- /dev/null |
25 |
+++ b/app-text/xpdf/files/xpdf-CVE-2019-17064.patch |
26 |
@@ -0,0 +1,24 @@ |
27 |
+Fix CVE-2019-17064 |
28 |
+ |
29 |
+Fix NULL pointer dereference by initializing field before use. |
30 |
+https://forum.xpdfreader.com/viewtopic.php?f=3&t=41890#p42672 |
31 |
+ |
32 |
+diff '--color=auto' -Naurd xpdf-4.02.orig/xpdf/Catalog.cc xpdf-4.02/xpdf/Catalog.cc |
33 |
+--- xpdf-4.02.orig/xpdf/Catalog.cc 2019-09-25 22:54:33.000000000 +0300 |
34 |
++++ xpdf-4.02/xpdf/Catalog.cc 2020-03-01 12:05:43.235486706 +0300 |
35 |
+@@ -159,6 +159,7 @@ |
36 |
+ baseURI = NULL; |
37 |
+ form = NULL; |
38 |
+ embeddedFiles = NULL; |
39 |
++ pageLabels = NULL; |
40 |
+ #if MULTITHREADED |
41 |
+ gInitMutex(&pageMutex); |
42 |
+ #endif |
43 |
+@@ -241,7 +242,6 @@ |
44 |
+ // get the ViewerPreferences object |
45 |
+ catDict.dictLookupNF("ViewerPreferences", &viewerPrefs); |
46 |
+ |
47 |
+- pageLabels = NULL; |
48 |
+ if (catDict.dictLookup("PageLabels", &obj)->isDict()) { |
49 |
+ readPageLabelTree(&obj); |
50 |
+ } |
51 |
|
52 |
diff --git a/app-text/xpdf/xpdf-4.02-r2.ebuild b/app-text/xpdf/xpdf-4.02-r2.ebuild |
53 |
new file mode 100644 |
54 |
index 00000000000..96d625e1826 |
55 |
--- /dev/null |
56 |
+++ b/app-text/xpdf/xpdf-4.02-r2.ebuild |
57 |
@@ -0,0 +1,141 @@ |
58 |
+# Copyright 1999-2020 Gentoo Authors |
59 |
+# Distributed under the terms of the GNU General Public License v2 |
60 |
+ |
61 |
+EAPI=7 |
62 |
+ |
63 |
+inherit cmake-utils desktop xdg |
64 |
+ |
65 |
+DESCRIPTION="The PDF viewer and tools" |
66 |
+HOMEPAGE="https://www.xpdfreader.com" |
67 |
+SRC_URI="https://xpdfreader-dl.s3.amazonaws.com/${P}.tar.gz |
68 |
+ i18n? ( |
69 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-arabic.tar.gz |
70 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-chinese-simplified.tar.gz |
71 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-chinese-traditional.tar.gz |
72 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-cyrillic.tar.gz |
73 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-greek.tar.gz |
74 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-hebrew.tar.gz |
75 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-japanese.tar.gz |
76 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-korean.tar.gz |
77 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-latin2.tar.gz |
78 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-thai.tar.gz |
79 |
+ https://xpdfreader-dl.s3.amazonaws.com/xpdf-turkish.tar.gz |
80 |
+ )" |
81 |
+ |
82 |
+LICENSE="GPL-2 GPL-3 i18n? ( BSD )" |
83 |
+SLOT="0" |
84 |
+KEYWORDS="~amd64 ~x86" |
85 |
+IUSE="cmyk cups i18n icons +libpaper metric opi png +textselect utils" |
86 |
+ |
87 |
+BDEPEND=" |
88 |
+ icons? ( media-gfx/inkscape ) |
89 |
+" |
90 |
+DEPEND=" |
91 |
+ cups? ( |
92 |
+ dev-qt/qtprintsupport:5 |
93 |
+ net-print/cups |
94 |
+ ) |
95 |
+ libpaper? ( app-text/libpaper ) |
96 |
+ utils? ( png? ( media-libs/libpng:0 ) ) |
97 |
+ dev-qt/qtnetwork:5 |
98 |
+ dev-qt/qtwidgets:5 |
99 |
+ media-libs/freetype |
100 |
+ sys-libs/zlib |
101 |
+" |
102 |
+RDEPEND="${DEPEND} |
103 |
+ media-fonts/urw-fonts |
104 |
+" |
105 |
+ |
106 |
+PATCHES=( |
107 |
+ "${FILESDIR}"/${PN}-automagic.patch |
108 |
+ "${FILESDIR}"/${PN}-visibility.patch |
109 |
+ "${FILESDIR}"/${PN}-shared-libs.patch |
110 |
+ "${FILESDIR}"/${PN}-CVE-2019-17064.patch |
111 |
+) |
112 |
+ |
113 |
+src_prepare() { |
114 |
+ sed -i \ |
115 |
+ "s|/usr/local/etc|${EPREFIX}/etc|; |
116 |
+ s|/usr/local|${EPREFIX}/usr|" \ |
117 |
+ doc/sample-xpdfrc || die |
118 |
+ |
119 |
+ if use i18n; then |
120 |
+ sed -i "s|/usr/local|${EPREFIX}/usr|" "${WORKDIR}"/*/add-to-xpdfrc || die |
121 |
+ fi |
122 |
+ |
123 |
+ cmake-utils_src_prepare |
124 |
+} |
125 |
+ |
126 |
+src_configure() { |
127 |
+ local mycmakeargs=( |
128 |
+ -DA4_PAPER=$(usex metric) |
129 |
+ -DNO_TEXT_SELECT=$(usex textselect off on) |
130 |
+ -DOPI_SUPPORT=$(usex opi) |
131 |
+ -DSPLASH_CMYK=$(usex cmyk) |
132 |
+ -DWITH_LIBPAPER=$(usex libpaper) |
133 |
+ -DWITH_LIBPNG=$(usex png) |
134 |
+ -DXPDFWIDGET_PRINTING=$(usex cups) |
135 |
+ -DSYSTEM_XPDFRC="${EPREFIX}/etc/xpdfrc" |
136 |
+ ) |
137 |
+ cmake-utils_src_configure |
138 |
+} |
139 |
+ |
140 |
+src_compile() { |
141 |
+ cmake-utils_src_compile |
142 |
+ |
143 |
+ if use icons; then |
144 |
+ sizes="16 22 24 32 36 48 64 72 96 128 192 256 512" |
145 |
+ cd xpdf-qt |
146 |
+ mkdir $sizes |
147 |
+ local i |
148 |
+ for i in $sizes; do |
149 |
+ inkscape xpdf-icon.svg -w $i -h $i -e $i/xpdf.png |
150 |
+ done |
151 |
+ fi |
152 |
+} |
153 |
+ |
154 |
+src_install() { |
155 |
+ cmake-utils_src_install |
156 |
+ |
157 |
+ domenu "${FILESDIR}/xpdf.desktop" |
158 |
+ newicon -s scalable xpdf-qt/xpdf-icon.svg xpdf.svg |
159 |
+ if use icons; then |
160 |
+ local i |
161 |
+ for i in $sizes; do |
162 |
+ doicon -s $i xpdf-qt/$i/xpdf.png |
163 |
+ done |
164 |
+ unset sizes |
165 |
+ fi |
166 |
+ |
167 |
+ insinto /etc |
168 |
+ newins doc/sample-xpdfrc xpdfrc |
169 |
+ |
170 |
+ local d i |
171 |
+ if use utils; then |
172 |
+ for d in "bin" "share/man/man1"; do |
173 |
+ pushd "${ED}/usr/${d}" || die |
174 |
+ for i in pdf*; do |
175 |
+ mv "${i}" "x${i}" || die |
176 |
+ done |
177 |
+ popd || die |
178 |
+ done |
179 |
+ |
180 |
+ einfo "PDF utilities were renamed from pdf* to xpdf* to avoid file collisions" |
181 |
+ einfo "with other packages" |
182 |
+ else |
183 |
+ rm -rf "${ED}"/usr/bin/pdf* \ |
184 |
+ "${ED}"/usr/share/man/man1/pdf* \ |
185 |
+ "${ED}"/usr/$(get_libdir) || die |
186 |
+ fi |
187 |
+ |
188 |
+ if use i18n; then |
189 |
+ for i in arabic chinese-simplified chinese-traditional cyrillic greek \ |
190 |
+ hebrew japanese korean latin2 thai turkish; do |
191 |
+ insinto "/usr/share/xpdf/${i}" |
192 |
+ doins -r $(find -O3 "${WORKDIR}/xpdf-${i}" -maxdepth 1 -mindepth 1 \ |
193 |
+ ! -name README ! -name add-to-xpdfrc || die) |
194 |
+ |
195 |
+ cat "${WORKDIR}/xpdf-${i}/add-to-xpdfrc" >> "${ED}/etc/xpdfrc" || die |
196 |
+ done |
197 |
+ fi |
198 |
+} |