1 |
commit: 37d716c1306ca3ee3877d4041c4cbfd9f4e1eecd |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 14 16:54:48 2020 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 14 17:20:46 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37d716c1 |
7 |
|
8 |
app-text/poppler: Fix pdfsig segfault |
9 |
|
10 |
Reported-by: Michelangelo Scopelliti <kernelpanic <AT> gmx.it> |
11 |
Closes: https://bugs.gentoo.org/721118 |
12 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
13 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
14 |
|
15 |
.../files/poppler-0.88.0-pdfsig-crash.patch | 30 +++++ |
16 |
app-text/poppler/poppler-0.88.0-r1.ebuild | 124 +++++++++++++++++++++ |
17 |
2 files changed, 154 insertions(+) |
18 |
|
19 |
diff --git a/app-text/poppler/files/poppler-0.88.0-pdfsig-crash.patch b/app-text/poppler/files/poppler-0.88.0-pdfsig-crash.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..4f29727b6fc |
22 |
--- /dev/null |
23 |
+++ b/app-text/poppler/files/poppler-0.88.0-pdfsig-crash.patch |
24 |
@@ -0,0 +1,30 @@ |
25 |
+From 5cdb78fde50e3dc16006070b0884dfb6b23d964c Mon Sep 17 00:00:00 2001 |
26 |
+From: Albert Astals Cid <aacid@×××.org> |
27 |
+Date: Thu, 14 May 2020 00:22:33 +0200 |
28 |
+Subject: [PATCH] Fix crash in PDFDoc::getSignatureFields when there's no Forms |
29 |
+ at all |
30 |
+ |
31 |
+--- |
32 |
+ poppler/PDFDoc.cc | 4 +++- |
33 |
+ 1 file changed, 3 insertions(+), 1 deletion(-) |
34 |
+ |
35 |
+diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc |
36 |
+index 572c77be..4b5621fc 100644 |
37 |
+--- a/poppler/PDFDoc.cc |
38 |
++++ b/poppler/PDFDoc.cc |
39 |
+@@ -613,10 +613,12 @@ static void addSignatureFieldsToVector(FormField *ff, std::vector<FormFieldSigna |
40 |
+ |
41 |
+ std::vector<FormFieldSignature*> PDFDoc::getSignatureFields() |
42 |
+ { |
43 |
+-// const int num_pages = getNumPages(); |
44 |
+ std::vector<FormFieldSignature*> res; |
45 |
+ |
46 |
+ const Form *f = catalog->getForm(); |
47 |
++ if (!f) |
48 |
++ return res; |
49 |
++ |
50 |
+ const int nRootFields = f->getNumFields(); |
51 |
+ for (int i = 0; i < nRootFields; ++i) { |
52 |
+ FormField *ff = f->getRootField(i); |
53 |
+-- |
54 |
+2.26.2 |
55 |
|
56 |
diff --git a/app-text/poppler/poppler-0.88.0-r1.ebuild b/app-text/poppler/poppler-0.88.0-r1.ebuild |
57 |
new file mode 100644 |
58 |
index 00000000000..487596c917a |
59 |
--- /dev/null |
60 |
+++ b/app-text/poppler/poppler-0.88.0-r1.ebuild |
61 |
@@ -0,0 +1,124 @@ |
62 |
+# Copyright 2005-2020 Gentoo Authors |
63 |
+# Distributed under the terms of the GNU General Public License v2 |
64 |
+ |
65 |
+EAPI=7 |
66 |
+ |
67 |
+inherit cmake toolchain-funcs xdg-utils |
68 |
+ |
69 |
+if [[ ${PV} == *9999* ]] ; then |
70 |
+ inherit git-r3 |
71 |
+ EGIT_REPO_URI="https://anongit.freedesktop.org/git/poppler/poppler.git" |
72 |
+ SLOT="0/9999" |
73 |
+else |
74 |
+ SRC_URI="https://poppler.freedesktop.org/${P}.tar.xz" |
75 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
76 |
+ SLOT="0/99" # CHECK THIS WHEN BUMPING!!! SUBSLOT IS libpoppler.so SOVERSION |
77 |
+fi |
78 |
+ |
79 |
+DESCRIPTION="PDF rendering library based on the xpdf-3.0 code base" |
80 |
+HOMEPAGE="https://poppler.freedesktop.org/" |
81 |
+ |
82 |
+LICENSE="GPL-2" |
83 |
+IUSE="cairo cjk curl +cxx debug doc +introspection +jpeg +jpeg2k +lcms nss png qt5 tiff +utils" |
84 |
+ |
85 |
+# No test data provided |
86 |
+RESTRICT="test" |
87 |
+ |
88 |
+BDEPEND=" |
89 |
+ dev-util/glib-utils |
90 |
+ virtual/pkgconfig |
91 |
+" |
92 |
+DEPEND=" |
93 |
+ media-libs/fontconfig |
94 |
+ media-libs/freetype |
95 |
+ sys-libs/zlib |
96 |
+ cairo? ( |
97 |
+ dev-libs/glib:2 |
98 |
+ x11-libs/cairo |
99 |
+ introspection? ( dev-libs/gobject-introspection:= ) |
100 |
+ ) |
101 |
+ curl? ( net-misc/curl ) |
102 |
+ jpeg? ( virtual/jpeg:0 ) |
103 |
+ jpeg2k? ( >=media-libs/openjpeg-2.3.0-r1:2= ) |
104 |
+ lcms? ( media-libs/lcms:2 ) |
105 |
+ nss? ( >=dev-libs/nss-3.19:0 ) |
106 |
+ png? ( media-libs/libpng:0= ) |
107 |
+ qt5? ( |
108 |
+ dev-qt/qtcore:5 |
109 |
+ dev-qt/qtgui:5 |
110 |
+ dev-qt/qtxml:5 |
111 |
+ ) |
112 |
+ tiff? ( media-libs/tiff:0 ) |
113 |
+" |
114 |
+RDEPEND="${DEPEND} |
115 |
+ cjk? ( app-text/poppler-data ) |
116 |
+" |
117 |
+ |
118 |
+DOCS=( AUTHORS NEWS README.md README-XPDF ) |
119 |
+ |
120 |
+PATCHES=( |
121 |
+ "${FILESDIR}/${PN}-0.60.1-qt5-dependencies.patch" |
122 |
+ "${FILESDIR}/${PN}-0.28.1-fix-multilib-configuration.patch" |
123 |
+ "${FILESDIR}/${PN}-0.82.0-respect-cflags.patch" |
124 |
+ "${FILESDIR}/${PN}-0.61.0-respect-cflags.patch" |
125 |
+ "${FILESDIR}/${PN}-0.57.0-disable-internal-jpx.patch" |
126 |
+ "${FILESDIR}/${P}-pdfsig-crash.patch" |
127 |
+) |
128 |
+ |
129 |
+src_prepare() { |
130 |
+ cmake_src_prepare |
131 |
+ |
132 |
+ # Clang doesn't grok this flag, the configure nicely tests that, but |
133 |
+ # cmake just uses it, so remove it if we use clang |
134 |
+ if [[ ${CC} == clang ]] ; then |
135 |
+ sed -e 's/-fno-check-new//' -i cmake/modules/PopplerMacros.cmake || die |
136 |
+ fi |
137 |
+ |
138 |
+ if ! grep -Fq 'cmake_policy(SET CMP0002 OLD)' CMakeLists.txt ; then |
139 |
+ sed -e '/^cmake_minimum_required/acmake_policy(SET CMP0002 OLD)' \ |
140 |
+ -i CMakeLists.txt || die |
141 |
+ else |
142 |
+ einfo "policy(SET CMP0002 OLD) - workaround can be removed" |
143 |
+ fi |
144 |
+} |
145 |
+ |
146 |
+src_configure() { |
147 |
+ xdg_environment_reset |
148 |
+ local mycmakeargs=( |
149 |
+ -DBUILD_GTK_TESTS=OFF |
150 |
+ -DBUILD_QT5_TESTS=OFF |
151 |
+ -DBUILD_CPP_TESTS=OFF |
152 |
+ -DRUN_GPERF_IF_PRESENT=OFF |
153 |
+ -DENABLE_SPLASH=ON |
154 |
+ -DENABLE_ZLIB=ON |
155 |
+ -DENABLE_ZLIB_UNCOMPRESS=OFF |
156 |
+ -DENABLE_UNSTABLE_API_ABI_HEADERS=ON |
157 |
+ -DUSE_FLOAT=OFF |
158 |
+ -DWITH_Cairo=$(usex cairo) |
159 |
+ -DENABLE_LIBCURL=$(usex curl) |
160 |
+ -DENABLE_CPP=$(usex cxx) |
161 |
+ -DWITH_JPEG=$(usex jpeg) |
162 |
+ -DENABLE_DCTDECODER=$(usex jpeg libjpeg none) |
163 |
+ -DENABLE_LIBOPENJPEG=$(usex jpeg2k openjpeg2 none) |
164 |
+ -DENABLE_CMS=$(usex lcms lcms2 none) |
165 |
+ -DWITH_NSS3=$(usex nss) |
166 |
+ -DWITH_PNG=$(usex png) |
167 |
+ $(cmake_use_find_package qt5 Qt5Core) |
168 |
+ -DWITH_TIFF=$(usex tiff) |
169 |
+ -DENABLE_UTILS=$(usex utils) |
170 |
+ ) |
171 |
+ use cairo && mycmakeargs+=( -DWITH_GObjectIntrospection=$(usex introspection) ) |
172 |
+ |
173 |
+ cmake_src_configure |
174 |
+} |
175 |
+ |
176 |
+src_install() { |
177 |
+ cmake_src_install |
178 |
+ |
179 |
+ # live version doesn't provide html documentation |
180 |
+ if use cairo && use doc && [[ ${PV} != *9999* ]]; then |
181 |
+ # For now install gtk-doc there |
182 |
+ insinto /usr/share/gtk-doc/html/poppler |
183 |
+ doins -r "${S}"/glib/reference/html/* |
184 |
+ fi |
185 |
+} |