forked from pool/mupdf
Accepting request 235816 from home:gberh:branches:Publishing
- update to version 1.4 * Headline changes: * CMYK rendering (mudraw PWG and PAM formats) * TIFF viewer (with multi-page support). * Added MuJS Javascript interpreter. * MuJS is the default, V8 and JavaScriptCore are compile time options. * Javascript support has to be explicitly enabled with pdf_enable_js. * All viewers now have JavaScript enabled in the default builds. * Viewers: * X11: Horizontal scroll wheel support. * X11: Status bar display with warnings. * Android: Digital signatures. * iOS: Links, form filling, annotation editing, and javascript. * iOS: Reflow mode. * WinRT: Printing. * WinRT: Improved zooming behaviour. * Tools: * mudraw: Banded rendering with -B /band-height/. * mudraw: Select output format with -F /format/. * mudraw: Write to stdout if you use '-' as the output file name. * mudraw: Add TGA output format. * mudraw: Improved SVG output. * mutool show: Write output to file instead of stdout with -o /filename/. * mutool clean: Clean content streams with -s option. * Annotations: OBS-URL: https://build.opensuse.org/request/show/235816 OBS-URL: https://build.opensuse.org/package/show/Publishing/mupdf?expand=0&rev=16
This commit is contained in:
parent
93934f6a3a
commit
f7bbc23fc0
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aba8b31bee9cc0a16abedab5e31c81c65996cba5591e62a50a79bea2a63d4478
|
||||
size 14594969
|
3
mupdf-1.4-source.tar.gz
Normal file
3
mupdf-1.4-source.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:018bab9520b5e93bb33ab07b0472fdf9f768c5801769f95b9a696941b633ec22
|
||||
size 13253644
|
@ -1,126 +0,0 @@
|
||||
From: Simon Bünzli <zeniko@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 21:04:51 +0000 (+0100)
|
||||
Subject: Bug 694957: fix stack buffer overflow in xps_parse_color
|
||||
X-Git-Url: http://git.ghostscript.com/?p=mupdf.git;a=commitdiff_plain;h=60dabde18d7fe12b19da8b509bdfee9cc886aafc
|
||||
|
||||
Bug 694957: fix stack buffer overflow in xps_parse_color
|
||||
|
||||
xps_parse_color happily reads more than FZ_MAX_COLORS values out of a
|
||||
ContextColor array which overflows the passed in samples array.
|
||||
Limiting the number of allowed samples to FZ_MAX_COLORS and make sure
|
||||
to use that constant for all callers fixes the problem.
|
||||
|
||||
Thanks to Jean-Jamil Khalifé for reporting and investigating the issue
|
||||
and providing a sample exploit file.
|
||||
---
|
||||
|
||||
diff --git a/source/xps/xps-common.c b/source/xps/xps-common.c
|
||||
index b780f42..32a30ba 100644
|
||||
--- a/source/xps/xps-common.c
|
||||
+++ b/source/xps/xps-common.c
|
||||
@@ -89,7 +89,7 @@ xps_begin_opacity(xps_document *doc, const fz_matrix *ctm, const 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(doc->ctx);
|
||||
+ *csp = fz_device_rgb(ctx);
|
||||
|
||||
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,12 +268,17 @@ 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)
|
||||
{
|
||||
@@ -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(doc->ctx); break;
|
||||
- case 4: *csp = fz_device_rgb(doc->ctx); break;
|
||||
- case 5: *csp = fz_device_cmyk(doc->ctx); break;
|
||||
- default: *csp = fz_device_gray(doc->ctx); break;
|
||||
+ case 2: *csp = fz_device_gray(ctx); break;
|
||||
+ case 4: *csp = fz_device_rgb(ctx); break;
|
||||
+ case 5: *csp = fz_device_cmyk(ctx); break;
|
||||
+ default: *csp = fz_device_gray(ctx); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/source/xps/xps-glyphs.c b/source/xps/xps-glyphs.c
|
||||
index b26e18d..e621257 100644
|
||||
--- a/source/xps/xps-glyphs.c
|
||||
+++ b/source/xps/xps-glyphs.c
|
||||
@@ -590,7 +590,7 @@ xps_parse_glyphs(xps_document *doc, const 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/source/xps/xps-gradient.c b/source/xps/xps-gradient.c
|
||||
index 7d03f89..76188e9 100644
|
||||
--- a/source/xps/xps-gradient.c
|
||||
+++ b/source/xps/xps-gradient.c
|
||||
@@ -39,7 +39,7 @@ xps_parse_gradient_stops(xps_document *doc, char *base_uri, fz_xml *node,
|
||||
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 --git a/source/xps/xps-path.c b/source/xps/xps-path.c
|
||||
index b97ee17..ea84a81 100644
|
||||
--- a/source/xps/xps-path.c
|
||||
+++ b/source/xps/xps-path.c
|
||||
@@ -826,7 +826,7 @@ xps_parse_path(xps_document *doc, const fz_matrix *ctm, char *base_uri, xps_reso
|
||||
|
||||
fz_stroke_state *stroke = NULL;
|
||||
fz_matrix transform;
|
||||
- float samples[32];
|
||||
+ float samples[FZ_MAX_COLORS];
|
||||
fz_colorspace *colorspace;
|
||||
fz_path *path = NULL;
|
||||
fz_path *stroke_path = NULL;
|
@ -1,15 +1,28 @@
|
||||
Index: mupdf-1.3-source/Makerules
|
||||
Index: mupdf-1.4-source/Makerules
|
||||
===================================================================
|
||||
--- mupdf-1.3-source.orig/Makerules
|
||||
+++ mupdf-1.3-source/Makerules
|
||||
@@ -62,8 +62,8 @@ SYS_X11_LIBS = $(shell pkg-config --libs
|
||||
--- mupdf-1.4-source.orig/Makerules
|
||||
+++ mupdf-1.4-source/Makerules
|
||||
@@ -71,8 +71,8 @@ SYS_X11_LIBS = $(shell pkg-config --libs
|
||||
|
||||
SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2)
|
||||
SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2)
|
||||
-SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjpeg1)
|
||||
-SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjpeg1)
|
||||
+SYS_OPENJPEG_CFLAGS = -I/usr/include/openjpeg-2.0
|
||||
+SYS_OPENJPEG_LIBS = -lopenjp2
|
||||
+SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2)
|
||||
+SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjp2)
|
||||
SYS_JBIG2DEC_LIBS = -ljbig2dec
|
||||
SYS_JPEG_LIBS = -ljpeg
|
||||
SYS_ZLIB_LIBS = -lz
|
||||
Index: mupdf-1.4-source/source/fitz/load-jpx.c
|
||||
===================================================================
|
||||
--- mupdf-1.4-source.orig/source/fitz/load-jpx.c
|
||||
+++ mupdf-1.4-source/source/fitz/load-jpx.c
|
||||
@@ -117,7 +117,7 @@ fz_load_jpx(fz_context *ctx, unsigned ch
|
||||
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);
|
||||
|
||||
|
@ -1,3 +1,78 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri May 30 09:16:58 UTC 2014 - gber@opensuse.org
|
||||
|
||||
- update to version 1.4
|
||||
* Headline changes:
|
||||
* CMYK rendering (mudraw PWG and PAM formats)
|
||||
* TIFF viewer (with multi-page support).
|
||||
* Added MuJS Javascript interpreter.
|
||||
* MuJS is the default, V8 and JavaScriptCore are compile time
|
||||
options.
|
||||
* Javascript support has to be explicitly enabled with
|
||||
pdf_enable_js.
|
||||
* All viewers now have JavaScript enabled in the default
|
||||
builds.
|
||||
* Viewers:
|
||||
* X11: Horizontal scroll wheel support.
|
||||
* X11: Status bar display with warnings.
|
||||
* Android: Digital signatures.
|
||||
* iOS: Links, form filling, annotation editing, and javascript.
|
||||
* iOS: Reflow mode.
|
||||
* WinRT: Printing.
|
||||
* WinRT: Improved zooming behaviour.
|
||||
* Tools:
|
||||
* mudraw: Banded rendering with -B /band-height/.
|
||||
* mudraw: Select output format with -F /format/.
|
||||
* mudraw: Write to stdout if you use '-' as the output file
|
||||
name.
|
||||
* mudraw: Add TGA output format.
|
||||
* mudraw: Improved SVG output.
|
||||
* mutool show: Write output to file instead of stdout with -o
|
||||
/filename/.
|
||||
* mutool clean: Clean content streams with -s option.
|
||||
* Annotations:
|
||||
* Improved font handling.
|
||||
* Form fields.
|
||||
* Free text.
|
||||
* Sticky notes.
|
||||
* Optimizations:
|
||||
* glyph cache: Partial eviction.
|
||||
* glyph cache: Run-length compressed glyphs.
|
||||
* Smarter handling of subpixel metrics in text rendering.
|
||||
* Optimized blitting functions.
|
||||
* Optimized gradient mesh drawing.
|
||||
* API changes and additions:
|
||||
* fz_stream API reworked: replace "read" function with "next".
|
||||
* "Rebind" functions to associate context bound objects with
|
||||
another context:
|
||||
fz_output, fz_stream, fz_device and fz_document.
|
||||
* Introduce "document handlers" to detect and open different
|
||||
file types.
|
||||
* Must now call fz_register_document_handlers() to register
|
||||
the defaults.
|
||||
* May register your own handlers as well to work with
|
||||
g fz_open_document.
|
||||
* Hook to load system fonts: fz_install_load_system_font_funcs.
|
||||
* PDF xref cache flushing functions (mark/clear/clear-to-mark).
|
||||
* Add our own "printf" set of functions to format strings and
|
||||
write to fz_output:
|
||||
* Format %f as short as possible while preserving precision.
|
||||
* Has %C for formatting a unicode character as UTF-8.
|
||||
* Has %M to format fz_matrix.
|
||||
* Has %R to format fz_rect.
|
||||
* Has %q and %( to format strings with escaped characters.
|
||||
* PDF process interface: allow PDF interpreter to do more than
|
||||
just draw!
|
||||
* Content stream state cleaning filter.
|
||||
* Content stream rewriting filter.
|
||||
* PDF digital signatures.
|
||||
* Stroke states may now be stored on the stack.
|
||||
* Improved fz_path internals.
|
||||
* Gradient mesh drawing interface has been improved.
|
||||
* Save files with incremental updates.
|
||||
- drop obsolete mupdf-fix-array-overflow.patch
|
||||
- switch to mujs instead of v8
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 14 10:04:23 UTC 2014 - gber@opensuse.org
|
||||
|
||||
|
20
mupdf.spec
20
mupdf.spec
@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
Name: mupdf
|
||||
Version: 1.3
|
||||
Version: 1.4
|
||||
Release: 0
|
||||
Summary: Lightweight PDF and XPS Viewer and Parser and Rendering Library
|
||||
License: AGPL-3.0+
|
||||
@ -27,10 +27,8 @@ Url: http://mupdf.com/
|
||||
Source0: http://mupdf.googlecode.com/files/mupdf-%{version}-source.tar.gz
|
||||
Source1: mupdf.desktop
|
||||
Source2: mupdf.png
|
||||
# PATCH-FIX-OPENSUSE mupdf-fix-openjpeg2.patch gber@opensuse.org -- Fix cflags, libs of openjpeg2 on openSUSE
|
||||
# PATCH-FIX-OPENSUSE mupdf-fix-openjpeg2.patch gber@opensuse.org -- Fix build against openjpeg2 2.1 on openSUSE
|
||||
Patch0: mupdf-fix-openjpeg2.patch
|
||||
# PATCH-FIX-UPSTREAM mupdf-fix-array-overflow.patch http://bugs.ghostscript.com/show_bug.cgi?id=694957 bnc#863975 gber@opensuse.org -- Fix stack-based buffer overflow in xps_parse_color()
|
||||
Patch1: mupdf-fix-array-overflow.patch
|
||||
BuildRequires: freetype-devel
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: jbig2dec-devel
|
||||
@ -38,15 +36,10 @@ BuildRequires: libcurl-devel
|
||||
BuildRequires: libjpeg-devel
|
||||
BuildRequires: openjpeg2-devel
|
||||
BuildRequires: update-desktop-files
|
||||
BuildRequires: v8-devel
|
||||
BuildRequires: v8-private-headers-devel
|
||||
BuildRequires: xorg-x11-devel
|
||||
BuildRequires: zlib-devel
|
||||
Requires: xdg-utils
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
#set ExclusiveArch: %{ix86} x86_64 %{arm}. v8 is available only
|
||||
# for those architectures
|
||||
ExclusiveArch: %{ix86} x86_64 %{arm}
|
||||
|
||||
%description
|
||||
MuPDF is a lightweight PDF and XPS viewer and parser/rendering library.
|
||||
@ -71,11 +64,10 @@ based on mupdf.
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}-source
|
||||
|
||||
# do not use the inlined copies of build dpendencies
|
||||
rm -rf thirdparty
|
||||
# do not use the inlined copies of build dpendencies except for mujs
|
||||
rm -rf $(ls -d thirdparty/*/ | grep -v mujs)
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
mkdir docs/examples
|
||||
for src in docs/*.c; do
|
||||
@ -88,7 +80,7 @@ done
|
||||
# do no set CFLAGS which is used by the build system itself!
|
||||
export XCFLAGS="%{optflags} -fPIC -pthread"
|
||||
make %{?_smp_mflags} \
|
||||
verbose=1 \
|
||||
verbose=yes \
|
||||
NOCURL= \
|
||||
CURL_CFLAGS="$(pkg-config --libs libcurl)" \
|
||||
CURL_LIBS=" -pthread $(pkg-config --libs libcurl)"
|
||||
@ -124,6 +116,7 @@ install -D -p -m 644 %{SOURCE2} \
|
||||
%{_bindir}/mupdf
|
||||
%{_bindir}/mudraw
|
||||
%{_bindir}/mutool
|
||||
%{_bindir}/mujstest
|
||||
%{_datadir}/applications/mupdf.desktop
|
||||
%{_datadir}/pixmaps/mupdf.png
|
||||
%{_mandir}/man1/mu*.1*
|
||||
@ -132,6 +125,5 @@ install -D -p -m 644 %{SOURCE2} \
|
||||
%defattr(-,root,root,-)
|
||||
%{_includedir}/mupdf/
|
||||
%{_libdir}/libmupdf.a
|
||||
%{_libdir}/libmupdf-js-none.a
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user