This commit is contained in:
Pavel Zhukov 2014-05-06 23:37:47 +02:00
parent fae027ba62
commit 4dc10c710f
5 changed files with 18 additions and 146 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/mupdf-0.9-source.tar.gz
/mupdf-1.0-source.tar.gz
/mupdf-1.1-source.tar.gz
/mupdf-1.4-source.tar.gz

View File

@ -1,14 +0,0 @@
--- a/fitz/image_jpx.c
+++ b/fitz/image_jpx.c
@@ -50,8 +50,11 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs
evtmgr.info_handler = fz_opj_info_callback;
opj_set_default_decoder_parameters(&params);
+
+#ifdef OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG
if (indexed)
params.flags |= OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
+#endif
info = opj_create_decompress(format);
opj_set_event_mgr((opj_common_ptr)info, &evtmgr, ctx);

View File

@ -1,102 +0,0 @@
diff --git a/xps/xps_common.c b/xps/xps_common.c
index eddef1b..31c2a5e 100644
--- a/xps/xps_common.c
+++ b/xps/xps_common.c
@@ -89,7 +89,7 @@ xps_begin_opacity(xps_document *doc, fz_matrix ctm, fz_rect area,
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];
}
@@ -208,12 +208,13 @@ void
xps_parse_color(xps_document *doc, char *base_uri, char *string,
fz_colorspace **csp, float *samples)
{
+ fz_context *ctx = doc->ctx;
char *p;
int i, n;
char buf[1024];
char *profile;
- *csp = fz_device_rgb;
+ *csp = fz_device_rgb;
samples[0] = 1;
samples[1] = 0;
@@ -259,7 +260,7 @@ xps_parse_color(xps_document *doc, char *base_uri, char *string,
profile = strchr(buf, ' ');
if (!profile)
{
- fz_warn(doc->ctx, "cannot find icc profile uri in '%s'", string);
+ fz_warn(ctx, "cannot find icc profile uri in '%s'", string);
return;
}
@@ -267,15 +268,20 @@ xps_parse_color(xps_document *doc, char *base_uri, char *string,
p = strchr(profile, ' ');
if (!p)
{
- fz_warn(doc->ctx, "cannot find component values in '%s'", profile);
+ fz_warn(ctx, "cannot find component values in '%s'", profile);
return;
}
*p++ = 0;
n = count_commas(p) + 1;
+ if (n > FZ_MAX_COLORS)
+ {
+ fz_warn(ctx, "ignoring %d color components (max %d allowed)", n - FZ_MAX_COLORS, FZ_MAX_COLORS);
+ n = FZ_MAX_COLORS;
+ }
i = 0;
- while (i < n)
- {
+ while (i < n)
+ {
samples[i++] = fz_atof(p);
p = strchr(p, ',');
if (!p)
@@ -292,10 +298,10 @@ xps_parse_color(xps_document *doc, char *base_uri, char *string,
/* TODO: load ICC profile */
switch (n)
{
- case 2: *csp = fz_device_gray; break;
- case 4: *csp = fz_device_rgb; break;
- case 5: *csp = fz_device_cmyk; break;
- default: *csp = fz_device_gray; break;
+ case 2: *csp = fz_device_gray; break;
+ case 4: *csp = fz_device_rgb; break;
+ case 5: *csp = fz_device_cmyk; break;
+ default: *csp = fz_device_gray; break;
}
}
}
diff --git a/xps/xps_glyphs.c b/xps/xps_glyphs.c
index 6b26201..5a4faf0 100644
--- a/xps/xps_glyphs.c
+++ b/xps/xps_glyphs.c
@@ -587,7 +587,7 @@ xps_parse_glyphs(xps_document *doc, fz_matrix ctm,
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 --git a/xps/xps_path.c b/xps/xps_path.c
index 8650fbb..84fe14f 100644
--- a/xps/xps_path.c
+++ b/xps/xps_path.c
@@ -825,7 +825,7 @@ xps_parse_path(xps_document *doc, fz_matrix ctm, char *base_uri, xps_resource *d
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;

View File

@ -1,16 +1,13 @@
Name: mupdf
Version: 1.1
Release: 5%{?dist}
Version: 1.4
Release: 1%{?dist}
Summary: A lightweight PDF viewer and toolkit
Group: Applications/Publishing
License: GPLv3
URL: http://mupdf.com/
Source0: http://mupdf.com/download/%{name}-%{version}-source.tar.gz
Source1: %{name}.desktop
## http://bugs.ghostscript.com/show_bug.cgi?format=multiple&id=693010
Patch0: %{name}-upstream.patch
Patch1: %{name}-xps_fix.patch
BuildRequires: openjpeg-devel jbig2dec-devel desktop-file-utils
BuildRequires: openjpeg2-devel jbig2dec-devel desktop-file-utils
BuildRequires: libjpeg-devel freetype-devel libXext-devel
%description
@ -40,25 +37,20 @@ applications that use mupdf and static libraries
%prep
%setup -q -n %{name}-%{version}-source
%patch0 -p1
%patch1 -p1
%build
export CFLAGS="%{optflags}"
make -j1
## %{?_smp_mflags} verbose=1
make %{?_smp_mflags} verbose=1
%install
make DESTDIR=%{buildroot} install prefix=%{buildroot}/usr libdir=%{buildroot}%{_libdir}
make DESTDIR=%{buildroot} install prefix=%{_prefix} libdir=%{_libdir}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
install -D -m644 debian/%{name}.xpm %{buildroot}/%{_datadir}/pixmaps/%{name}.xpm
## filename conflict with poppler
### mv %{buildroot}%{_bindir}/pdfinfo %{buildroot}%{_bindir}/pdfinfo-mupdf
install -D -m644 platform/debian/%{name}.xpm %{buildroot}/%{_datadir}/pixmaps/%{name}.xpm
## fix strange permissons
chmod 0644 %{buildroot}/%{_includedir}/*.h
chmod 0644 %{buildroot}%{_libdir}/*.a
find %{buildroot}/%{_mandir} -type f -exec chmod 0644 {} \;
find %{buildroot}/%{_docdir} -type f -exec chmod 0644 {} \;
find %{buildroot}/%{_includedir} -type f -exec chmod 0644 {} \;
%post
update-desktop-database &> /dev/null || :
@ -68,27 +60,22 @@ update-desktop-database &> /dev/null || :
%files
%defattr(-,root,root,-)
%doc COPYING README
%{_bindir}/mupdf
%{_bindir}/mudraw
%{_bindir}/mubusy
%{_bindir}/*
%{_datadir}/applications/mupdf.desktop
%{_mandir}/man1/mudraw.1.gz
%{_mandir}/man1/mubusy.1.gz
%{_mandir}/man1/mupdf.1.gz
%{_mandir}/man1/*.1.gz
%{_datadir}/pixmaps/mupdf.xpm
%files devel
%defattr(-,root,root,-)
%{_includedir}/fitz.h
%{_includedir}/memento.h
%{_includedir}/mucbz.h
%{_includedir}/mupdf.h
%{_includedir}/muxps.h
%{_libdir}/libfitz.a
%{_includedir}/%{name}
%{_libdir}/lib%{name}.a
%Changelog
* Tue May 6 2014 Pavel Zhukov <pavel@landgraf-desktop.zhukoff.net> - 1.4-1
- New release 1.4 (#1087287)
%changelog
* Fri Jan 24 2014 Pavel Zhukov <landgraf@fedoraproject.org> - 1.1-5
- Fix stack overflow (#1056699)

View File

@ -1 +1 @@
f7b5fd753f40aca207e9afd70d8f8edf mupdf-1.1-source.tar.gz
0f6840a7020db0c833b0c090ca1864ec mupdf-1.4-source.tar.gz