office/mupdf: Updated for version 1.5.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2014-08-22 17:36:38 +07:00 committed by Willy Sudiarto Raharjo
parent 539b2ab872
commit ce1935d000
11 changed files with 174 additions and 256 deletions

View File

@ -9,3 +9,14 @@ MuPDF is also small, fast, and yet complete. It supports PDF 1.7 with
transparency, encryption, hyperlinks, annotations, searching and more. It
also reads XPS and OpenXPS documents. MuPDF is written modularly, so
features can be added on by integrators if they so desire.
Notes:
1. By default, mupdf is built without JavaScript support. If you want
to try mupdf's experimental JavaScript support, build with MUJS=yes in
the script's environment.
2. This build is for mupdf-1.5, but it has also been tested with
mupdf-1.4. Download mupdf-1.4-source.tar.gz and run the script with
VERSION=1.4 set in the environment, if for some reason you need the
older version.

View File

@ -1,36 +0,0 @@
diff -Naur mupdf-1.2-source/apps/man/mudraw.1 mupdf-1.2-source.patched/apps/man/mudraw.1
--- mupdf-1.2-source/apps/man/mudraw.1 2013-02-13 09:25:07.000000000 -0500
+++ mupdf-1.2-source.patched/apps/man/mudraw.1 2013-06-19 02:15:42.000000000 -0400
@@ -83,7 +83,6 @@
Comma separated list of ranges to render.
.SH SEE ALSO
.BR mupdf (1),
-.BR mupdfclean (1).
-.BR mupdfshow (1).
+.BR mutool (1).
.SH AUTHOR
MuPDF is Copyright 2006-2012 Artifex Software, Inc.
diff -Naur mupdf-1.2-source/apps/man/mupdf.1 mupdf-1.2-source.patched/apps/man/mupdf.1
--- mupdf-1.2-source/apps/man/mupdf.1 2013-02-13 09:25:07.000000000 -0500
+++ mupdf-1.2-source.patched/apps/man/mupdf.1 2013-06-19 02:31:19.000000000 -0400
@@ -13,6 +13,9 @@
.SH OPTIONS
A description of each of the supported options is included below.
.TP
+.B \-b bits
+Set anti-aliasing quality in bits (0=off, 8=best).
+.TP
.B \-p password
Uses the given password to open an encrypted PDF file.
The password is tried both as user and owner password.
@@ -85,8 +88,7 @@
Sending a \fBSIGHUP\fR signal to the mupdf process will also cause the viewed
file to be reloaded automatically, for use in e.g. build scripts.
.SH SEE ALSO
-.BR mupdfclean (1),
-.BR mupdfdraw (1),
-.BR mupdfshow (1).
+.BR mutool (1),
+.BR mudraw (1).
.SH AUTHOR
MuPDF is Copyright 2006-2012 Artifex Software, Inc.

View File

@ -2,22 +2,29 @@
# Slackware build script for mupdf
# Written by Hubert Hesse (slackbuilds@hubertscorner.de)
# Originally written by Hubert Hesse (slackbuilds@hubertscorner.de).
# Heavily modified by B. Watson (yalhcru@gmail.com).
# Modified 20130618 by B. Watson (yalhcru@gmail.com):
# - Took over maintenance
# - Updated for mupdf 1.2
# - Build library shared, not static
# - Build with system zlib, libjpeg, openjpeg, jbig2dec, libtiff, libpng,
# liblcms2 instead of bundled sources (which made the lib + exes *huge*).
# Also, the included libjpeg is too new (it broke zathura-pdf-mupdf).
# - Include mutool in package (instead of just its man page)
# - Add CHANGES CONTRIBUTORS doc/* to /usr/doc
# - Use DESTDIR libdir mandir instead of patching makefile
# - Updated README & slack-desc to mention XPS and CBZ
# - Fix the man pages slightly
# 20140822 bkw:
# - Updated for mupdf-1.5.
# - Hosting the source on my server, so I know it won't get moved
# to an archive/ dir when a new release comes out.
# - Script also tested with 1.4:
# DOWNLOAD="http://urchlay.naptime.net/~urchlay/src/mupdf-1.4-source.tar.gz"
# MD5SUM="0f6840a7020db0c833b0c090ca1864ec"
# - Add .desktop, .pc, icon
# - Got rid of CVE-2014-2013 patch (integrated by upstream in 1.4).
# - Remove man page patch (not needed for 1.4 and up).
# - Replace openjpeg dep with newly-submitted openjpeg2.
# - Small patch to allow building with openjpeg 2.1.0 (rather than 2.0.0).
# - For now, revert to static libmupdf. Upstream doesn't support
# shared libs, they hate it when distro packages create them,
# and rolling my own shared libs is more PITA than it's worth.
# - Upstream renamed the binary to mupdf-x11, add symlinks so scripts
# or .desktop files can still run it as mupdf, and "man mupdf" will
# still work.
# Modified 20140224 by B. Watson (yalhcru@gmail.com):
# 20140224 bkw:
# - backported security fix for CVE-2014-2013. I will be upgrading this
# build to mupdf-1.3, but it'll take more work than I currently have
# time for:
@ -31,11 +38,24 @@
# The security fix is needed now, it's a tiny patch, and shouldn't have
# to wait on all that other stuff.
# 20140318 bkw: fix permissions on headers and man pages
# 20140318 bkw: fix permissions on headers and man pages.
# 20130618 bkw:
# - Took over maintenance.
# - Updated for mupdf 1.2.
# - Build library shared, not static.
# - Build with system zlib, libjpeg, openjpeg, jbig2dec, libtiff, libpng,
# liblcms2 instead of bundled sources (which made the lib + exes *huge*).
# Also, the included libjpeg is too new (it broke zathura-pdf-mupdf).
# - Include mutool in package (instead of just its man page).
# - Add CHANGES CONTRIBUTORS doc/* to /usr/doc.
# - Use DESTDIR libdir mandir instead of patching makefile.
# - Updated README & slack-desc to mention XPS and CBZ.
# - Fix the man pages slightly.
PRGNAM=mupdf
VERSION=${VERSION:-1.2}
BUILD=${BUILD:-3}
VERSION=${VERSION:-1.5}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -70,36 +90,45 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION-source
unzip $CWD/$PRGNAM-$VERSION-source.zip
tar xvf $CWD/$PRGNAM-$VERSION-source.tar.gz
cd $PRGNAM-$VERSION-source
# don't find/chown/chmod until after the thirdparty junk is removed.
# Build against system libs instead of bundled ones. If we didn't do this,
# libmupdf.a would be useless for building anything else.
# Everything removed from thirdparty/ has to be installed systemwide, and must
# either be a Slackware core pkg, or mentioned in REQUIRES= in the .info
# file... except mujs, which is mupdf's javascript support lib. If missing,
# we end up with a mupdf with no JS support, which is probably a good idea
# for the default build. If you want javascript, MUJS=yes in the env.
MUJS="${MUJS:-no}"
[ "$MUJS" = "yes" ] && mv thirdparty/mujs .keep
rm -rf thirdparty/*
[ "$MUJS" = "yes" ] && mv .keep thirdparty/mujs
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# We want a shared library, not static.
# This patch based on http://bugs.ghostscript.com/show_bug.cgi?id=693009
# with the following changes:
# - actually applies to mupdf-1.2
# - links the applications dynamically
# - doesn't even build/install the static lib by default
# - adds mutool to list of stuff installed to $prefix/bin
patch -p1 < $CWD/shared_libfitz.diff
# opj_stream_set_user_data() now takes 3 args in openjpeg 2.1.
# Patch applies to both 1.4 and 1.5.
patch -p1 < $CWD/openjpeg-2.1-api-change.diff
# 'see also' mentions nonexistent stuff (mupdfclean, mupdfshow), also
# the -b option to mupdf was missing.
patch -p1 < $CWD/man_page.diff
# Makerules incorrectly tries to build with openjpeg-1.x system lib, while
# the bundled version is 2.0, and the code uses the 2.0 API.
# Actually this was fixed in 1.5, but I leave this here in case someone
# wants to use this script to build mupdf-1.4 for some reason.
sed -i 's,libopenjpeg1,libopenjp2,g' Makerules
# Build against system libs instead of shipped ones
sed -i 's,libopenjpeg,libopenjpeg1,' Makerules
rm -rf thirdparty
# patch from upstream git, fix security vulnerability CVE-2014-2013.
# from here: http://git.ghostscript.com/?p=user/zeniko/mupdf.git;h=60dabde18d
# Patch is for mupdf-1.3, I've backported it to 1.2 for now.
patch -p1 < $CWD/xps_parse_color_overflow_fix.diff
# Hard-code the version number so it'll stop trying to use git to retrieve
# it and spewing harmless but scary 'fatal: Not a git repository' errors.
sed -i "/^VERSION/s,=.*,= $VERSION," Makefile
make build=release prefix=/usr XCFLAGS="$SLKCFLAGS"
make \
@ -110,20 +139,61 @@ make \
DESTDIR=$PKG \
install
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
if [ "$MUJS" = "yes" ]; then
# If JS support included, applications will need to link with this:
install -m0664 build/release/libmujs.a $PKG/usr/lib$LIBDIRSUFFIX/
install -m0664 thirdparty/mujs/mujs.h $PKG/usr/include/
else
# Don't need mujstest if no javascript support.
rm -f $PKG/usr/bin/mujstest
fi
strip $PKG/usr/bin/*
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
chmod -x $PKG/usr/include/*.h $PKG/usr/man/man?/*
# Compatibility symlinks. Older versions, the binary is just "mupdf".
# Separate -curl binary exists in 1.5 but not 1.4.
ln -s $PRGNAM-x11 $PKG/usr/bin/$PRGNAM
ln -s $PRGNAM.1.gz $PKG/usr/man/man1/$PRGNAM-x11.1.gz
[ -e $PKG/usr/bin/$PRGNAM-x11-curl ] && \
ln -s $PRGNAM.1.gz $PKG/usr/man/man1/$PRGNAM-x11-curl.1.gz
# Installed permissions are atrocious (everything 755).
find $PKG -type f | xargs chmod 644
chmod 755 $PKG/usr/bin/*
# .desktop taken from debian and modified:
# - make it validate.
# - add mime types for cbz and xps.
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
# Icon converted from platform/x11/mupdf.ico, with icotool.
mkdir -p $PKG/usr/share/pixmaps
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
# .pc file taken from debian and parameterized.
PCLIBS="-l$PRGNAM"
[ "$MUJS" = "yes" ] && PCLIBS="$PCLIBS -lmujs"
mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/pkgconfig/
sed -e "s,@LIB@,lib$LIBDIRSUFFIX,g" \
-e "s,@VERSION@,$VERSION,g" \
-e "s,@PCLIBS@,$PCLIBS,g" \
$CWD/$PRGNAM.pc > $PKG/usr/lib$LIBDIRSUFFIX/pkgconfig/$PRGNAM.pc
# slack-desc will conveniently say whether javascript is built in.
WITH=without
[ "$MUJS" = "yes" ] && WITH=with
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README COPYING CHANGES CONTRIBUTORS doc/* $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README COPYING CHANGES CONTRIBUTORS docs/*.* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
sed "s,@WITH@,$WITH," < $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View File

@ -0,0 +1,17 @@
[Desktop Entry]
Name=MuPDF
GenericName=Document viewer
Comment=PDF/CBZ/XPS file viewer
Exec=mupdf %f
TryExec=mupdf
Icon=mupdf
Terminal=false
Type=Application
MimeType=application/pdf;application/x-pdf;application/x-cbz;application/vnd.ms-xpsdocument;application/oxps;
Categories=Viewer;Graphics;
NoDisplay=true
Actions=View;
[Desktop Action View]
Name=View
Exec=mupdf %f

View File

@ -1,10 +1,10 @@
PRGNAM="mupdf"
VERSION="1.2"
VERSION="1.5"
HOMEPAGE="http://www.mupdf.com/"
DOWNLOAD="http://mupdf.googlecode.com/files/mupdf-1.2-source.zip"
MD5SUM="230e7d679f54c91edd1ebe54f6f8bc15"
DOWNLOAD="http://urchlay.naptime.net/~urchlay/src/mupdf-1.5-source.tar.gz"
MD5SUM="89bd4ddc74c266062ebf2702741bb173"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="jbig2dec openjpeg"
REQUIRES="openjpeg2 jbig2dec"
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

12
office/mupdf/mupdf.pc Normal file
View File

@ -0,0 +1,12 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/@LIB@
includedir=${prefix}/include
Name: mupdf
Description: Library for rendering PDF documents
Requires.private: freetype2
Version: @VERSION@
Libs: -L${libdir} @PCLIBS@
Libs.private: -lopenjp2 -ljbig2dec -ljpeg -lz -lm
Cflags: -I${includedir}

BIN
office/mupdf/mupdf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,13 @@
diff -Naur mupdf-1.5-source/source/fitz/load-jpx.c mupdf-1.5-source.patched/source/fitz/load-jpx.c
--- mupdf-1.5-source/source/fitz/load-jpx.c 2014-06-10 11:09:28.000000000 -0400
+++ mupdf-1.5-source.patched/source/fitz/load-jpx.c 2014-08-21 23:49:21.000000000 -0400
@@ -116,7 +116,8 @@
opj_stream_set_read_function(stream, fz_opj_stream_read);
opj_stream_set_skip_function(stream, fz_opj_stream_skip);
opj_stream_set_seek_function(stream, fz_opj_stream_seek);
- opj_stream_set_user_data(stream, &sb);
+ opj_stream_set_user_data(stream, &sb, NULL);
+
/* Set the length to avoid an assert */
opj_stream_set_user_data_length(stream, size);

View File

@ -1,109 +0,0 @@
diff -Naur mupdf-1.2-source/Makefile mupdf-1.2-source.patched/Makefile
--- mupdf-1.2-source/Makefile 2013-02-13 09:25:07.000000000 -0500
+++ mupdf-1.2-source.patched/Makefile 2013-06-19 00:18:06.000000000 -0400
@@ -12,7 +12,7 @@
# Do not specify CFLAGS or LIBS on the make invocation line - specify
# XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that
# set a variable that was set on the command line.
-CFLAGS += $(XCFLAGS) -Ifitz -Ipdf -Ixps -Icbz -Iscripts
+CFLAGS += $(XCFLAGS) -fPIC -Ifitz -Ipdf -Ixps -Icbz -Iscripts
LIBS += $(XLIBS) -lfreetype -ljbig2dec -ljpeg -lopenjpeg -lz -lm
LIBS_V8 = $(LIBS) $(V8LIBS)
@@ -37,6 +37,7 @@
CC_CMD = $(QUIET_CC) $(CC) $(CFLAGS) -o $@ -c $<
CXX_CMD = $(QUIET_CXX) $(CXX) $(CFLAGS) -o $@ -c $<
AR_CMD = $(QUIET_AR) $(AR) cr $@ $^
+SO_CMD = $(QUIET_LINK) $(CC) -fPIC --shared -Wl,-soname -Wl,`basename $@ | sed 's,\.[^.]*$$,,'` $^ -o $@
LINK_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
LINK_V8_CMD = $(QUIET_LINK) $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS_V8)
MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
@@ -79,7 +80,9 @@
# --- Fitz, MuPDF, MuXPS and MuCBZ library ---
-FITZ_LIB := $(OUT)/libfitz.a
+FITZ_LIB_A := $(OUT)/libfitz.a
+FITZ_LIB_SO := $(OUT)/libfitz.so.1.0
+FITZ_LIB_SO1 := $(OUT)/libfitz.so.1
FITZ_V8_LIB := $(OUT)/libfitzv8.a
FITZ_SRC := $(notdir $(wildcard fitz/*.c draw/*.c))
@@ -91,10 +94,10 @@
MUXPS_SRC := $(notdir $(wildcard xps/*.c))
MUCBZ_SRC := $(notdir $(wildcard cbz/*.c))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.o))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUXPS_SRC:%.c=%.o))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUCBZ_SRC:%.c=%.o))
+FITZ_OBJECT_FILES := $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o)) \
+ $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.o)) \
+ $(addprefix $(OUT)/, $(MUXPS_SRC:%.c=%.o)) \
+ $(addprefix $(OUT)/, $(MUCBZ_SRC:%.c=%.o))
$(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o))
$(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUPDF_V8_SRC:%.c=%.o))
@@ -102,9 +105,19 @@
$(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUXPS_SRC:%.c=%.o))
$(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUCBZ_SRC:%.c=%.o))
-libs: $(FITZ_LIB) $(THIRD_LIBS)
libs_v8: libs $(FITZ_V8_LIB)
+$(FITZ_LIB_A) : $(FITZ_OBJECT_FILES)
+$(FITZ_LIB_SO) : $(FITZ_OBJECT_FILES)
+
+libs: $(FITZ_LIB_A) $(FITZ_LIB_SO1) $(THIRD_LIBS)
+
+$(FITZ_LIB_SO) :
+ $(SO_CMD)
+
+$(FITZ_LIB_SO1) : $(FITZ_LIB_SO)
+ @cd $(OUT) && ln -s `basename $(FITZ_LIB_SO)` libfitz.so.1
+
# --- Generated CMAP, FONT and JAVASCRIPT files ---
CMAPDUMP := $(OUT)/cmapdump
@@ -162,14 +175,14 @@
# --- Tools and Apps ---
MUDRAW := $(addprefix $(OUT)/, mudraw)
-$(MUDRAW) : $(FITZ_LIB) $(THIRD_LIBS)
+$(MUDRAW) : $(FITZ_LIB_SO1) $(THIRD_LIBS)
MUTOOL := $(addprefix $(OUT)/, mutool)
-$(MUTOOL) : $(addprefix $(OUT)/, pdfclean.o pdfextract.o pdfinfo.o pdfposter.o pdfshow.o) $(FITZ_LIB) $(THIRD_LIBS)
+$(MUTOOL) : $(addprefix $(OUT)/, pdfclean.o pdfextract.o pdfinfo.o pdfposter.o pdfshow.o) $(FITZ_LIB_SO1) $(THIRD_LIBS)
ifeq "$(NOX11)" ""
MUVIEW := $(OUT)/mupdf
-$(MUVIEW) : $(FITZ_LIB) $(THIRD_LIBS)
+$(MUVIEW) : $(FITZ_LIB_SO1) $(THIRD_LIBS)
$(MUVIEW) : $(addprefix $(OUT)/, x11_main.o x11_image.o pdfapp.o)
$(LINK_CMD) $(X11_LIBS)
@@ -208,18 +221,19 @@
incdir ?= $(prefix)/include
mandir ?= $(prefix)/share/man
-install: $(FITZ_LIB) $(MUVIEW) $(MUDRAW) $(MUTOOL)
+install: $(FITZ_LIB_SO) $(MUVIEW) $(MUDRAW) $(MUTOOL)
install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(incdir) $(DESTDIR)$(mandir)/man1
- install $(FITZ_LIB) $(DESTDIR)$(libdir)
+ install $(FITZ_LIB_SO) $(DESTDIR)$(libdir)
+ ln -s `basename $(FITZ_LIB_SO)` $(DESTDIR)$(libdir)/libfitz.so
install fitz/memento.h fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h $(DESTDIR)$(incdir)
- install $(MUVIEW) $(MUDRAW) $(MUBUSY) $(DESTDIR)$(bindir)
+ install $(MUVIEW) $(MUDRAW) $(MUTOOL) $(MUBUSY) $(DESTDIR)$(bindir)
install $(wildcard apps/man/*.1) $(DESTDIR)$(mandir)/man1
# --- Clean and Default ---
all: all-nojs $(JSTARGETS)
-all-nojs: $(THIRD_LIBS) $(FITZ_LIB) $(MUVIEW) $(MUDRAW) $(MUTOOL)
+all-nojs: $(THIRD_LIBS) $(FITZ_LIB_SO) $(MUVIEW) $(MUDRAW) $(MUTOOL)
third: $(THIRD_LIBS)

View File

@ -15,5 +15,5 @@ mupdf: the look of a printed page on screen.
mupdf:
mupdf: http://www.mupdf.com/
mupdf:
mupdf:
mupdf: This package was built @WITH@ JavaSscript support.
mupdf:

View File

@ -1,60 +0,0 @@
diff -Naur mupdf-1.2-source/xps/xps_common.c mupdf-1.2-source.patched/xps/xps_common.c
--- mupdf-1.2-source/xps/xps_common.c 2013-02-13 15:25:08.000000000 -0500
+++ mupdf-1.2-source.patched/xps/xps_common.c 2014-02-24 15:25:35.000000000 -0500
@@ -89,7 +89,7 @@
if (scb_color_att)
{
fz_colorspace *colorspace;
- float samples[32];
+ float samples[FZ_MAX_COLORS];
xps_parse_color(doc, base_uri, scb_color_att, &colorspace, samples);
opacity = opacity * samples[0];
}
@@ -273,6 +273,11 @@
*p++ = 0;
n = count_commas(p) + 1;
+ if (n > FZ_MAX_COLORS)
+ {
+ fz_warn(doc->ctx, "ignoring %d color components (max %d allowed)", n - FZ_MAX_COLORS, FZ_MAX_COLORS);
+ n = FZ_MAX_COLORS;
+ }
i = 0;
while (i < n)
{
diff -Naur mupdf-1.2-source/xps/xps_glyphs.c mupdf-1.2-source.patched/xps/xps_glyphs.c
--- mupdf-1.2-source/xps/xps_glyphs.c 2013-02-13 15:25:08.000000000 -0500
+++ mupdf-1.2-source.patched/xps/xps_glyphs.c 2014-02-24 15:25:57.000000000 -0500
@@ -591,7 +591,7 @@
if (fill_att)
{
- float samples[32];
+ float samples[FZ_MAX_COLORS];
fz_colorspace *colorspace;
xps_parse_color(doc, base_uri, fill_att, &colorspace, samples);
diff -Naur mupdf-1.2-source/xps/xps_gradient.c mupdf-1.2-source.patched/xps/xps_gradient.c
--- mupdf-1.2-source/xps/xps_gradient.c 2013-02-13 15:25:08.000000000 -0500
+++ mupdf-1.2-source.patched/xps/xps_gradient.c 2014-02-24 15:26:30.000000000 -0500
@@ -38,7 +38,7 @@
struct stop *stops, int maxcount)
{
fz_colorspace *colorspace;
- float sample[8];
+ float sample[FZ_MAX_COLORS];
float rgb[3];
int before, after;
int count;
diff -Naur mupdf-1.2-source/xps/xps_path.c mupdf-1.2-source.patched/xps/xps_path.c
--- mupdf-1.2-source/xps/xps_path.c 2013-02-13 15:25:08.000000000 -0500
+++ mupdf-1.2-source.patched/xps/xps_path.c 2014-02-24 15:27:07.000000000 -0500
@@ -826,7 +826,7 @@
fz_stroke_state *stroke = NULL;
fz_matrix transform;
- float samples[32];
+ float samples[FZ_MAX_COLORS];
fz_colorspace *colorspace;
fz_path *path;
fz_path *stroke_path = NULL;