1 |
commit: 54f3dbbee64dfa9de3193a16daa5ff254d4963b2 |
2 |
Author: Michael Weber <xmw <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 9 21:10:20 2017 +0000 |
4 |
Commit: Michael Weber <xmw <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 9 21:10:20 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54f3dbbe |
7 |
|
8 |
app-text/mupdf: Revbump to fix null pointer dereference (bug 608702) and heap overflow (bug 608712). |
9 |
|
10 |
Package-Manager: Portage-2.3.3, Repoman-2.3.1 |
11 |
|
12 |
.../mupdf/files/mupdf-1.10a-heap-overflow.patch | 40 ++++++ |
13 |
.../mupdf/files/mupdf-1.10a-null-pointer.patch | 21 +++ |
14 |
app-text/mupdf/mupdf-1.10a-r1.ebuild | 148 +++++++++++++++++++++ |
15 |
3 files changed, 209 insertions(+) |
16 |
|
17 |
diff --git a/app-text/mupdf/files/mupdf-1.10a-heap-overflow.patch b/app-text/mupdf/files/mupdf-1.10a-heap-overflow.patch |
18 |
new file mode 100644 |
19 |
index 0000000000..8b350ea859 |
20 |
--- /dev/null |
21 |
+++ b/app-text/mupdf/files/mupdf-1.10a-heap-overflow.patch |
22 |
@@ -0,0 +1,40 @@ |
23 |
+X-Git-Url: http://git.ghostscript.com/?p=mupdf.git;a=blobdiff_plain;f=source%2Ffitz%2Fpixmap.c;h=f1291dc29d49ead44c10785fd014a0d995e45a91;hp=a8317127da7af6d39eb86fe3ca02cb4106a9b262;hb=2c4e5867ee699b1081527bc6c6ea0e99a35a5c27;hpb=90fa6203ad032fe161d85a3e580941ce3d1216f0 |
24 |
+ |
25 |
+diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c |
26 |
+index a831712..f1291dc 100644 |
27 |
+--- a/source/fitz/pixmap.c |
28 |
++++ b/source/fitz/pixmap.c |
29 |
+@@ -1104,6 +1104,7 @@ fz_subsample_pixmap_ARM(unsigned char *ptr, int w, int h, int f, int factor, |
30 |
+ "@STACK:r1,<9>,factor,n,fwd,back,back2,fwd2,divX,back4,fwd4,fwd3,divY,back5,divXY\n" |
31 |
+ "ldr r4, [r13,#4*22] @ r4 = divXY \n" |
32 |
+ "ldr r5, [r13,#4*11] @ for (nn = n; nn > 0; n--) { \n" |
33 |
++ "ldr r8, [r13,#4*17] @ r8 = back4 \n" |
34 |
+ "18: @ \n" |
35 |
+ "mov r14,#0 @ r14= v = 0 \n" |
36 |
+ "sub r5, r5, r1, LSL #8 @ for (xx = x; xx > 0; x--) { \n" |
37 |
+@@ -1120,7 +1121,7 @@ fz_subsample_pixmap_ARM(unsigned char *ptr, int w, int h, int f, int factor, |
38 |
+ "mul r14,r4, r14 @ r14= v *= divX \n" |
39 |
+ "mov r14,r14,LSR #16 @ r14= v >>= 16 \n" |
40 |
+ "strb r14,[r9], #1 @ *d++ = r14 \n" |
41 |
+- "sub r0, r0, r8 @ s -= back2 \n" |
42 |
++ "sub r0, r0, r8 @ s -= back4 \n" |
43 |
+ "subs r5, r5, #1 @ n-- \n" |
44 |
+ "bgt 18b @ } \n" |
45 |
+ "21: @ \n" |
46 |
+@@ -1249,6 +1250,7 @@ fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor) |
47 |
+ x += f; |
48 |
+ if (x > 0) |
49 |
+ { |
50 |
++ int back4 = x * n - 1; |
51 |
+ div = x * y; |
52 |
+ for (nn = n; nn > 0; nn--) |
53 |
+ { |
54 |
+@@ -1263,7 +1265,7 @@ fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor) |
55 |
+ s -= back5; |
56 |
+ } |
57 |
+ *d++ = v / div; |
58 |
+- s -= back2; |
59 |
++ s -= back4; |
60 |
+ } |
61 |
+ } |
62 |
+ } |
63 |
|
64 |
diff --git a/app-text/mupdf/files/mupdf-1.10a-null-pointer.patch b/app-text/mupdf/files/mupdf-1.10a-null-pointer.patch |
65 |
new file mode 100644 |
66 |
index 0000000000..9a459b2801 |
67 |
--- /dev/null |
68 |
+++ b/app-text/mupdf/files/mupdf-1.10a-null-pointer.patch |
69 |
@@ -0,0 +1,21 @@ |
70 |
+From: Sebastian Rasmussen <sebras@×××××.com> |
71 |
+Date: Sat, 4 Feb 2017 05:21:20 +0000 (+0100) |
72 |
+Subject: Bug 697514: Write SVG output to stdout if no output specified. |
73 |
+X-Git-Url: http://git.ghostscript.com/?p=mupdf.git;a=commitdiff_plain;h=40ac85bfb676bb4373bda4b18f9fd90268c9f1e9 |
74 |
+ |
75 |
+Bug 697514: Write SVG output to stdout if no output specified. |
76 |
+--- |
77 |
+ |
78 |
+diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c |
79 |
+index 95b3440..720e7ff 100644 |
80 |
+--- a/source/tools/mudraw.c |
81 |
++++ b/source/tools/mudraw.c |
82 |
+@@ -578,7 +578,7 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in |
83 |
+ char buf[512]; |
84 |
+ fz_output *out; |
85 |
+ |
86 |
+- if (!strcmp(output, "-")) |
87 |
++ if (!output || !strcmp(output, "-")) |
88 |
+ out = fz_stdout(ctx); |
89 |
+ else |
90 |
+ { |
91 |
|
92 |
diff --git a/app-text/mupdf/mupdf-1.10a-r1.ebuild b/app-text/mupdf/mupdf-1.10a-r1.ebuild |
93 |
new file mode 100644 |
94 |
index 0000000000..fb40d437d1 |
95 |
--- /dev/null |
96 |
+++ b/app-text/mupdf/mupdf-1.10a-r1.ebuild |
97 |
@@ -0,0 +1,148 @@ |
98 |
+# Copyright 1999-2017 Gentoo Foundation |
99 |
+# Distributed under the terms of the GNU General Public License v2 |
100 |
+# $Id$ |
101 |
+ |
102 |
+EAPI=6 |
103 |
+ |
104 |
+inherit flag-o-matic toolchain-funcs |
105 |
+ |
106 |
+DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C" |
107 |
+HOMEPAGE="http://mupdf.com/" |
108 |
+SRC_URI="http://mupdf.com/downloads/${P}-source.tar.gz" |
109 |
+ |
110 |
+LICENSE="AGPL-3" |
111 |
+SLOT="0/${PV}" |
112 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos" |
113 |
+IUSE="X +curl javascript libressl opengl +openssl static static-libs vanilla" |
114 |
+ |
115 |
+LIB_DEPEND=" |
116 |
+ !libressl? ( dev-libs/openssl:0[static-libs?] ) |
117 |
+ libressl? ( dev-libs/libressl[static-libs?] ) |
118 |
+ javascript? ( >=dev-lang/mujs-0_p20160504 ) |
119 |
+ media-libs/freetype:2[static-libs?] |
120 |
+ media-libs/harfbuzz[static-libs?] |
121 |
+ media-libs/jbig2dec[static-libs?] |
122 |
+ media-libs/libpng:0[static-libs?] |
123 |
+ >=media-libs/openjpeg-2.1:2[static-libs?] |
124 |
+ net-misc/curl[static-libs?] |
125 |
+ virtual/jpeg[static-libs?] |
126 |
+ X? ( x11-libs/libX11[static-libs?] |
127 |
+ x11-libs/libXext[static-libs?] ) |
128 |
+ opengl? ( >=media-libs/glfw-3 )" |
129 |
+RDEPEND="${LIB_DEPEND}" |
130 |
+DEPEND="${RDEPEND} |
131 |
+ virtual/pkgconfig |
132 |
+ static-libs? ( ${LIB_DEPEND} ) |
133 |
+ static? ( ${LIB_DEPEND//?} |
134 |
+ app-arch/bzip2[static-libs] |
135 |
+ x11-libs/libXau[static-libs] |
136 |
+ x11-libs/libXdmcp[static-libs] |
137 |
+ x11-libs/libxcb[static-libs] )" |
138 |
+ |
139 |
+REQUIRED_USE="opengl? ( X !static !static-libs )" |
140 |
+ |
141 |
+S=${WORKDIR}/${P}-source |
142 |
+ |
143 |
+PATCHES=( |
144 |
+ "${FILESDIR}"/${PN}-1.9a-CFLAGS.patch |
145 |
+ "${FILESDIR}"/${PN}-1.9a-debug-build.patch |
146 |
+ "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch |
147 |
+ "${FILESDIR}"/${PN}-1.10a-Makerules-openssl-curl.patch |
148 |
+ "${FILESDIR}"/${PN}-1.8-system-glfw.patch |
149 |
+ "${FILESDIR}"/${PN}-1.10a-heap-overflow.patch |
150 |
+ "${FILESDIR}"/${PN}-1.10a-null-pointer.patch |
151 |
+) |
152 |
+ |
153 |
+src_prepare() { |
154 |
+ default |
155 |
+ use hppa && append-cflags -ffunction-sections |
156 |
+ |
157 |
+ rm -rf thirdparty || die |
158 |
+ |
159 |
+ if has_version ">=media-libs/openjpeg-2.1:2" ; then |
160 |
+ # Remove a switch, which prevents using shared libraries for openjpeg2. |
161 |
+ # See http://www.linuxfromscratch.org/blfs/view/cvs/pst/mupdf.html |
162 |
+ sed '/OPJ_STATIC$/d' -i source/fitz/load-jpx.c |
163 |
+ fi |
164 |
+ |
165 |
+ use javascript || \ |
166 |
+ sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \ |
167 |
+ -i include/mupdf/fitz/config.h |
168 |
+ |
169 |
+ sed -e "/^libdir=/s:/lib:/$(get_libdir):" \ |
170 |
+ -e "/^prefix=/s:=.*:=${EROOT}/usr:" \ |
171 |
+ -i platform/debian/${PN}.pc || die |
172 |
+ |
173 |
+ use vanilla || eapply \ |
174 |
+ "${FILESDIR}"/${PN}-1.3-zoom-2.patch |
175 |
+ |
176 |
+ sed -e "1iOS = Linux" \ |
177 |
+ -e "1iCC = $(tc-getCC)" \ |
178 |
+ -e "1iLD = $(tc-getCC)" \ |
179 |
+ -e "1iAR = $(tc-getAR)" \ |
180 |
+ -e "1iverbose = yes" \ |
181 |
+ -e "1ibuild = debug" \ |
182 |
+ -e "1iprefix = ${ED}usr" \ |
183 |
+ -e "1ilibdir = ${ED}usr/$(get_libdir)" \ |
184 |
+ -e "1idocdir = ${ED}usr/share/doc/${PF}" \ |
185 |
+ -e "1iHAVE_X11 = $(usex X)" \ |
186 |
+ -e "1iWANT_OPENSSL = $(usex openssl)" \ |
187 |
+ -e "1iWANT_CURL = $(usex curl)" \ |
188 |
+ -e "1iHAVE_MUJS = $(usex javascript)" \ |
189 |
+ -e "1iMUJS_LIBS = $(usex javascript -lmujs '')" \ |
190 |
+ -e "1iMUJS_CFLAGS =" \ |
191 |
+ -e "1iHAVE_GLFW = $(usex opengl yes no)" \ |
192 |
+ -i Makerules || die |
193 |
+ |
194 |
+ if use static-libs || use static ; then |
195 |
+ cp -a "${S}" "${S}"-static || die |
196 |
+ #add missing Libs.private for xcb and freetype |
197 |
+ sed -e 's:\(pkg-config --libs\):\1 --static:' \ |
198 |
+ -e '/^SYS_X11_LIBS = /s:\(.*\):\1 -lpthread:' \ |
199 |
+ -e '/^SYS_FREETYPE_LIBS = /s:\(.*\):\1 -lbz2:' \ |
200 |
+ -i "${S}"-static/Makerules || die |
201 |
+ fi |
202 |
+ |
203 |
+ my_soname=libmupdf.so.${PV} |
204 |
+ my_soname_js_none=libmupdf-js-none.so.${PV} |
205 |
+ sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \ |
206 |
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \ |
207 |
+ -e "/^MUPDF_LIB =/s:=.*:= \$(OUT)/${my_soname}:" \ |
208 |
+ -e "\$a\$(MUPDF_JS_NONE_LIB):" \ |
209 |
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \ |
210 |
+ -e "/install/s: COPYING : :" \ |
211 |
+ -i Makefile || die |
212 |
+} |
213 |
+ |
214 |
+src_compile() { |
215 |
+ emake XCFLAGS="-fpic" |
216 |
+ use static-libs && \ |
217 |
+ emake -C "${S}"-static build/debug/lib${PN}{,-js-none}.a |
218 |
+ use static && \ |
219 |
+ emake -C "${S}"-static XLIBS="-static" |
220 |
+} |
221 |
+ |
222 |
+src_install() { |
223 |
+ if use X ; then |
224 |
+ domenu platform/debian/${PN}.desktop |
225 |
+ doicon platform/debian/${PN}.xpm |
226 |
+ else |
227 |
+ rm docs/man/${PN}.1 |
228 |
+ fi |
229 |
+ |
230 |
+ emake install |
231 |
+ dosym ${my_soname} /usr/$(get_libdir)/lib${PN}.so |
232 |
+ |
233 |
+ use static-libs && \ |
234 |
+ dolib.a "${S}"-static/build/debug/lib${PN}{,-js-none}.a |
235 |
+ if use static ; then |
236 |
+ dobin "${S}"-static/build/debug/mu{tool,draw} |
237 |
+ use X && dobin "${S}"-static/build/debug/${PN}-x11 |
238 |
+ fi |
239 |
+ use X && dosym ${PN}-x11 /usr/bin/${PN} |
240 |
+ |
241 |
+ insinto /usr/$(get_libdir)/pkgconfig |
242 |
+ doins platform/debian/${PN}.pc |
243 |
+ |
244 |
+ dodoc README docs/*.{txt,c} |
245 |
+} |