From aa442929d873df32620891d03ca3f2c04a96431c15a8f85debff793c1767c21c Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 12 Mar 2019 13:41:52 +0000 Subject: [PATCH] Accepting request 684259 from home:guoyunhe:branches:Publishing - Add build dependencies: * liblcms2-devel * Mesa-libGL-devel * freeglut-devel * pkgconfig(openssl) * pkgconfig(xi) * pkgconfig(xrandr) - Change COPYING to %licnese instead of %doc - Update mupdf-no-strip.patch - Add patches from Fedora project: * mupdf-CVE-2018-16647.patch * mupdf-CVE-2018-16648.patch * mupdf-CVE-2018-18662.patch * 0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch * 0001-Write-placeholder-appearance-streams-for-digital-sig.patch * 0001-fix-build-on-big-endian.patch - Update to version 1.14: * New features: * Added "Source Han Serif" CJK fallback font. * Added more scripts to the Noto fallback fonts. * Multi-page PNM support. * "mutool show" now supports a path syntax for selecting objects to show. * Build system simplifications: * Auto-generated CMap, ICC, and JS source files are checked in to git. * Embedded CMap resources are now generated by a python script. * Embedded font resources are linked directly if using GNU ld or windows. * Namegen tool replaced by use of C macros. * Simplified Makefile. * Annotation editing: * New annotation editing mode in mupdf-gl. * Can create, edit, and delete most annotation types. * Can create appearance streams for most annotation types. * Can create appearance streams for Tx form fields. * Can create appearance streams for Ch form fields. * Form filling in mupdf-gl: * Can click buttons, checkboxes, and radioboxes. * Can fill out text fields using dialog box. * Can select choice options using dialog box. * Can verify and sign digital signatures. * Improved UI for mupdf-gl: * Password dialog. * Error dialog. * Open/save file dialog. * Snap selection to words or lines by holding control or control+shift. * Save and restore current location, bookmarks, and navigation history. * Bug fixes: * Improved CJK character fallback handling in EPUB. * API changes: * Pass rectangle and matrix structs by value. * Replaced PDF_NAME_Xxx macros with PDF_NAME(Xxx). * Added PDF_TRUE, PDF_FALSE, and PDF_NULL constant pdf_obj* macros. * Added helper functions: pdf_dict_get_int, etc. * Removed 'doc' argument in pdf_new_int, etc. * Quads instead of rects when highlighting and searching text. * mutool run: Pass arguments to script in scriptArgs global. OBS-URL: https://build.opensuse.org/request/show/684259 OBS-URL: https://build.opensuse.org/package/show/Publishing/mupdf?expand=0&rev=81 --- ...aved-sig_widget-pointer-to-sign-sign.patch | 58 +++++++++ ...r-appearance-streams-for-digital-sig.patch | 57 ++++++++ 0001-fix-build-on-big-endian.patch | 122 ++++++++++++++++++ mupdf-1.13.0.tar.xz | 3 - mupdf-1.14.0-source.tar.xz | 3 + mupdf-CVE-2018-16647.patch | 77 +++++++++++ mupdf-CVE-2018-16648.patch | 48 +++++++ mupdf-CVE-2018-18662.patch | 62 +++++++++ mupdf-gl.desktop | 10 ++ mupdf-no-strip.patch | 29 ++--- mupdf.changes | 59 +++++++++ mupdf.desktop | 10 +- mupdf.png | 3 - mupdf.spec | 115 ++++++++++------- 14 files changed, 581 insertions(+), 75 deletions(-) create mode 100644 0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch create mode 100644 0001-Write-placeholder-appearance-streams-for-digital-sig.patch create mode 100644 0001-fix-build-on-big-endian.patch delete mode 100644 mupdf-1.13.0.tar.xz create mode 100644 mupdf-1.14.0-source.tar.xz create mode 100644 mupdf-CVE-2018-16647.patch create mode 100644 mupdf-CVE-2018-16648.patch create mode 100644 mupdf-CVE-2018-18662.patch create mode 100644 mupdf-gl.desktop delete mode 100644 mupdf.png diff --git a/0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch b/0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch new file mode 100644 index 0000000..4b3121f --- /dev/null +++ b/0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch @@ -0,0 +1,58 @@ +From 68840d4a34e1e56ea9130158e8e163fb60550db4 Mon Sep 17 00:00:00 2001 +Message-Id: <68840d4a34e1e56ea9130158e8e163fb60550db4.1542273624.git.mjg@fedoraproject.org> +From: Tor Andersson +Date: Wed, 7 Nov 2018 19:44:55 +0100 +Subject: [PATCH] Fix 699840: Use saved sig_widget pointer to sign signatures, + not selected_annot. + +--- + platform/gl/gl-form.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/platform/gl/gl-form.c b/platform/gl/gl-form.c +index 94daa8e2..889554f2 100644 +--- a/platform/gl/gl-form.c ++++ b/platform/gl/gl-form.c +@@ -10,6 +10,10 @@ + #include "mupdf/helpers/pkcs7-check.h" + #include "mupdf/helpers/pkcs7-openssl.h" + ++static pdf_widget *sig_widget; ++static char sig_status[500]; ++static int sig_result; ++ + static char cert_filename[PATH_MAX]; + static struct input cert_password; + +@@ -22,7 +26,7 @@ static void do_sign(void) + fz_try(ctx) + { + signer = pkcs7_openssl_read_pfx(ctx, cert_filename, cert_password.text); +- pdf_sign_signature(ctx, pdf, selected_annot, signer); ++ pdf_sign_signature(ctx, pdf, sig_widget, signer); + ui_show_warning_dialog("Signed document successfully."); + } + fz_always(ctx) +@@ -33,7 +37,7 @@ static void do_sign(void) + fz_catch(ctx) + ui_show_warning_dialog("%s", fz_caught_message(ctx)); + +- if (pdf_update_page(ctx, selected_annot->page)) ++ if (pdf_update_page(ctx, sig_widget->page)) + render_page(); + } + +@@ -84,10 +88,6 @@ static void cert_file_dialog(void) + } + } + +-static pdf_widget *sig_widget; +-static char sig_status[500]; +-static int sig_result; +- + static void sig_dialog(void) + { + const char *label = pdf_field_label(ctx, sig_widget->page->doc, sig_widget->obj); +-- +2.19.1.1238.g4b45f61cc0 + diff --git a/0001-Write-placeholder-appearance-streams-for-digital-sig.patch b/0001-Write-placeholder-appearance-streams-for-digital-sig.patch new file mode 100644 index 0000000..3eadad1 --- /dev/null +++ b/0001-Write-placeholder-appearance-streams-for-digital-sig.patch @@ -0,0 +1,57 @@ +From 7f5ccdee1f8a990e1cd675bd1a7ab4673e797f46 Mon Sep 17 00:00:00 2001 +Message-Id: <7f5ccdee1f8a990e1cd675bd1a7ab4673e797f46.1542275308.git.mjg@fedoraproject.org> +From: Tor Andersson +Date: Wed, 7 Nov 2018 19:46:54 +0100 +Subject: [PATCH] Write placeholder appearance streams for digital signatures. + +A proper appearance stream is written when signing with a certificate. +This is just to create a placeholder appearance when the original document +did not write one. +--- + source/pdf/pdf-appearance.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c +index ceadfd09..c18d5860 100644 +--- a/source/pdf/pdf-appearance.c ++++ b/source/pdf/pdf-appearance.c +@@ -1066,6 +1066,25 @@ pdf_write_ch_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf + pdf_write_tx_widget_appearance(ctx, annot, buf, rect, bbox, matrix, res, text, ff); + } + ++static void ++pdf_write_sig_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf, ++ fz_rect *rect, fz_rect *bbox, fz_matrix *matrix, pdf_obj **res) ++{ ++ float x0 = rect->x0 + 1; ++ float y0 = rect->y0 + 1; ++ float x1 = rect->x1 - 1; ++ float y1 = rect->y1 - 1; ++ float w = x1 - x0; ++ float h = y1 - y0; ++ fz_append_printf(ctx, buf, "1 w\n0 G\n"); ++ fz_append_printf(ctx, buf, "%g %g %g %g re\n", x0, y0, w, h); ++ fz_append_printf(ctx, buf, "%g %g m %g %g l\n", x0, y0, x1, y1); ++ fz_append_printf(ctx, buf, "%g %g m %g %g l\n", x1, y0, x0, y1); ++ fz_append_printf(ctx, buf, "s\n"); ++ *bbox = *rect; ++ *matrix = fz_identity; ++} ++ + static void + pdf_write_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf, + fz_rect *rect, fz_rect *bbox, fz_matrix *matrix, pdf_obj **res) +@@ -1115,6 +1134,10 @@ pdf_write_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf, + fz_catch(ctx) + fz_rethrow(ctx); + } ++ else if (pdf_name_eq(ctx, ft, PDF_NAME(Sig))) ++ { ++ pdf_write_sig_widget_appearance(ctx, annot, buf, rect, bbox, matrix, res); ++ } + else + { + fz_throw(ctx, FZ_ERROR_GENERIC, "cannot create appearance stream for %s widgets", pdf_to_name(ctx, ft)); +-- +2.19.1.1238.g4b45f61cc0 + diff --git a/0001-fix-build-on-big-endian.patch b/0001-fix-build-on-big-endian.patch new file mode 100644 index 0000000..af23075 --- /dev/null +++ b/0001-fix-build-on-big-endian.patch @@ -0,0 +1,122 @@ +From 5fb79e6ccb805b3d94c8bb8eb0990d9944ae7602 Mon Sep 17 00:00:00 2001 +Message-Id: <5fb79e6ccb805b3d94c8bb8eb0990d9944ae7602.1528041417.git.mjg@fedoraproject.org> +From: Michael J Gruber +Date: Sun, 3 Jun 2018 17:55:46 +0200 +Subject: [PATCH] fix build on big endian + +0dc1153 ("Spread of context into all procedures and removal from +structures", 2017-04-26) missed a few spots that are relevant on big +endian only. + +Add the missing ContextIDs in the call chain so that the build succeeds +again. + +Signed-off-by: Michael J Gruber +--- + src/cmsmd5.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/cmsmd5.c b/src/cmsmd5.c +index 4b8f7f9..dd0925a 100644 +--- a/src/cmsmd5.c ++++ b/src/cmsmd5.c +@@ -29,7 +29,7 @@ + #ifdef CMS_USE_BIG_ENDIAN + + static +-void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs) ++void byteReverse(cmsContext ContextID, cmsUInt8Number * buf, cmsUInt32Number longs) + { + do { + +@@ -42,7 +42,7 @@ void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs) + } + + #else +-#define byteReverse(buf, len) ++#define byteReverse(ContextID, buf, len) + #endif + + +@@ -172,7 +172,7 @@ cmsHANDLE MD5alloc(cmsContext ContextID) + + + static +-void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) ++void MD5add(cmsContext ContextID, cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) + { + _cmsMD5* ctx = (_cmsMD5*) Handle; + cmsUInt32Number t; +@@ -196,7 +196,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) + } + + memmove(p, buf, t); +- byteReverse(ctx->in, 16); ++ byteReverse(ContextID, ctx->in, 16); + + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + buf += t; +@@ -205,7 +205,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) + + while (len >= 64) { + memmove(ctx->in, buf, 64); +- byteReverse(ctx->in, 16); ++ byteReverse(ContextID, ctx->in, 16); + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + buf += 64; + len -= 64; +@@ -216,7 +216,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) + + // Destroy the object and return the checksum + static +-void MD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle) ++void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle) + { + _cmsMD5* ctx = (_cmsMD5*) Handle; + cmsUInt32Number count; +@@ -232,21 +232,21 @@ void MD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle) + if (count < 8) { + + memset(p, 0, count); +- byteReverse(ctx->in, 16); ++ byteReverse(ContextID, ctx->in, 16); + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + + memset(ctx->in, 0, 56); + } else { + memset(p, 0, count - 8); + } +- byteReverse(ctx->in, 14); ++ byteReverse(ContextID, ctx->in, 14); + + ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0]; + ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1]; + + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + +- byteReverse((cmsUInt8Number *) ctx->buf, 4); ++ byteReverse(ContextID, (cmsUInt8Number *) ctx->buf, 4); + memmove(ProfileID ->ID8, ctx->buf, 16); + + _cmsFree(ctx ->ContextID, ctx); +@@ -291,7 +291,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile) + if (MD5 == NULL) goto Error; + + // Add all bytes +- MD5add(MD5, Mem, BytesNeeded); ++ MD5add(ContextID,MD5, Mem, BytesNeeded); + + // Temp storage is no longer needed + _cmsFree(ContextID, Mem); +@@ -300,7 +300,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile) + memmove(Icc, &Keep, sizeof(_cmsICCPROFILE)); + + // And store the ID +- MD5finish(&Icc ->ProfileID, MD5); ++ MD5finish(ContextID, &Icc ->ProfileID, MD5); + return TRUE; + + Error: +-- +2.18.0.rc0.294.g786209a621 + diff --git a/mupdf-1.13.0.tar.xz b/mupdf-1.13.0.tar.xz deleted file mode 100644 index cfb8dc4..0000000 --- a/mupdf-1.13.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:746698e0d5cd113bdcb8f65d096772029edea8cf20704f0d15c96cb5449a4904 -size 37243936 diff --git a/mupdf-1.14.0-source.tar.xz b/mupdf-1.14.0-source.tar.xz new file mode 100644 index 0000000..14fd344 --- /dev/null +++ b/mupdf-1.14.0-source.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:603e69a96b04cdf9b19a3e41bd7b20c63b39abdcfba81a7460fcdcc205f856df +size 41602372 diff --git a/mupdf-CVE-2018-16647.patch b/mupdf-CVE-2018-16647.patch new file mode 100644 index 0000000..65f1689 --- /dev/null +++ b/mupdf-CVE-2018-16647.patch @@ -0,0 +1,77 @@ +From 351c99d8ce23bbf7099dbd52771a095f67e45a2c Mon Sep 17 00:00:00 2001 +Message-Id: <351c99d8ce23bbf7099dbd52771a095f67e45a2c.1542272011.git.mjg@fedoraproject.org> +From: Sebastian Rasmussen +Date: Mon, 1 Oct 2018 15:13:13 +0800 +Subject: [PATCH] Avoid being smart about keeping only a single reference to + the buffer. + +When pdf_dev_pop() is called it will drop the reference to the buffer. +pdf_dev_push_new_buf() will either create a new buffer reference or take a reference to the existing buffer. +When pdf_dev_pop() is called unbalance this creates a problem as the +top level buffer will be unreferenced too many times. + +fails-32.pdf +--- + source/pdf/pdf-device.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c +index 31a7a10f..0103e9a7 100644 +--- a/source/pdf/pdf-device.c ++++ b/source/pdf/pdf-device.c +@@ -66,7 +66,6 @@ struct pdf_device_s + + pdf_document *doc; + pdf_obj *resources; +- fz_buffer *buffer; + + int in_text; + +@@ -1061,7 +1060,10 @@ pdf_dev_drop_device(fz_context *ctx, fz_device *dev) + int i; + + for (i = pdev->num_gstates-1; i >= 0; i--) ++ { ++ fz_drop_buffer(ctx, pdev->gstates[i].buf); + fz_drop_stroke_state(ctx, pdev->gstates[i].stroke_state); ++ } + + for (i = pdev->num_cid_fonts-1; i >= 0; i--) + fz_drop_font(ctx, pdev->cid_fonts[i]); +@@ -1069,7 +1071,6 @@ pdf_dev_drop_device(fz_context *ctx, fz_device *dev) + for (i = pdev->num_groups - 1; i >= 0; i--) + pdf_drop_obj(ctx, pdev->groups[i].ref); + +- fz_drop_buffer(ctx, pdev->buffer); + pdf_drop_obj(ctx, pdev->resources); + fz_free(ctx, pdev->cid_fonts); + fz_free(ctx, pdev->image_indices); +@@ -1111,10 +1112,13 @@ fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, fz_matrix topc + dev->super.begin_tile = pdf_dev_begin_tile; + dev->super.end_tile = pdf_dev_end_tile; + ++ fz_var(buf); ++ + fz_try(ctx) + { +- dev->buffer = fz_keep_buffer(ctx, buf); +- if (!buf) ++ if (buf) ++ buf = fz_keep_buffer(ctx, buf); ++ else + buf = fz_new_buffer(ctx, 256); + dev->doc = doc; + dev->resources = pdf_keep_obj(ctx, resources); +@@ -1136,8 +1140,7 @@ fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, fz_matrix topc + } + fz_catch(ctx) + { +- if (dev->gstates && dev->buffer == NULL) +- fz_drop_buffer(ctx, dev->gstates[0].buf); ++ fz_drop_buffer(ctx, buf); + fz_free(ctx, dev); + fz_rethrow(ctx); + } +-- +2.19.1.1238.g4b45f61cc0 + diff --git a/mupdf-CVE-2018-16648.patch b/mupdf-CVE-2018-16648.patch new file mode 100644 index 0000000..bfccdd5 --- /dev/null +++ b/mupdf-CVE-2018-16648.patch @@ -0,0 +1,48 @@ +From 38f883fe129a5e89306252a4676eaaf4bc968824 Mon Sep 17 00:00:00 2001 +Message-Id: <38f883fe129a5e89306252a4676eaaf4bc968824.1542272532.git.mjg@fedoraproject.org> +From: Tor Andersson +Date: Mon, 22 Oct 2018 17:16:35 +0200 +Subject: [PATCH] Fix text used as clip mask in pdfwrite device. + +Push the clip state, and pass the correct text rendering mode state. +--- + source/pdf/pdf-device.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c +index 4dd729b8..427e3b38 100644 +--- a/source/pdf/pdf-device.c ++++ b/source/pdf/pdf-device.c +@@ -734,9 +734,13 @@ pdf_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matri + { + pdf_device *pdev = (pdf_device*)dev; + fz_text_span *span; ++ ++ pdf_dev_end_text(ctx, pdev); ++ pdf_dev_push(ctx, pdev); ++ + for (span = text->head; span; span = span->next) + { +- pdf_dev_begin_text(ctx, pdev, span->trm, 0); ++ pdf_dev_begin_text(ctx, pdev, span->trm, 7); + pdf_dev_ctm(ctx, pdev, ctm); + pdf_dev_font(ctx, pdev, span->font); + pdf_dev_text_span(ctx, pdev, span); +@@ -748,9 +752,13 @@ pdf_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c + { + pdf_device *pdev = (pdf_device*)dev; + fz_text_span *span; ++ ++ pdf_dev_end_text(ctx, pdev); ++ pdf_dev_push(ctx, pdev); ++ + for (span = text->head; span; span = span->next) + { +- pdf_dev_begin_text(ctx, pdev, span->trm, 0); ++ pdf_dev_begin_text(ctx, pdev, span->trm, 7); + pdf_dev_font(ctx, pdev, span->font); + pdf_dev_ctm(ctx, pdev, ctm); + pdf_dev_text_span(ctx, pdev, span); +-- +2.19.1.1238.g4b45f61cc0 + diff --git a/mupdf-CVE-2018-18662.patch b/mupdf-CVE-2018-18662.patch new file mode 100644 index 0000000..fe46166 --- /dev/null +++ b/mupdf-CVE-2018-18662.patch @@ -0,0 +1,62 @@ +From 164ddc22ee0d5b63a81d5148f44c37dd132a9356 Mon Sep 17 00:00:00 2001 +Message-Id: <164ddc22ee0d5b63a81d5148f44c37dd132a9356.1542272812.git.mjg@fedoraproject.org> +From: Tor Andersson +Date: Mon, 5 Nov 2018 17:49:09 +0100 +Subject: [PATCH] Fix 700043: Don't assume a font is t3 just because + fz_outline_glyph fails. + +--- + source/fitz/svg-device.c | 31 ++++++++++++++++--------------- + 1 file changed, 16 insertions(+), 15 deletions(-) + +diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c +index 2876a89b..aaf53b99 100644 +--- a/source/fitz/svg-device.c ++++ b/source/fitz/svg-device.c +@@ -472,27 +472,28 @@ svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *s + /* Need to send this one */ + fz_rect rect; + fz_path *path; +- path = fz_outline_glyph(ctx, span->font, gid, fz_identity); +- if (path) ++ out = start_def(ctx, sdev); ++ fz_write_printf(ctx, out, "\n", fnt->id, gid); ++ if (fz_font_ft_face(ctx, span->font)) + { +- rect = fz_bound_path(ctx, path, NULL, fz_identity); +- shift.e = -rect.x0; +- shift.f = -rect.y0; +- fz_transform_path(ctx, path, shift); +- out = start_def(ctx, sdev); +- fz_write_printf(ctx, out, "\n", fnt->id, gid); +- fz_write_printf(ctx, out, "\n"); +- fz_drop_path(ctx, path); ++ path = fz_outline_glyph(ctx, span->font, gid, fz_identity); ++ if (path) ++ { ++ rect = fz_bound_path(ctx, path, NULL, fz_identity); ++ shift.e = -rect.x0; ++ shift.f = -rect.y0; ++ fz_transform_path(ctx, path, shift); ++ fz_write_printf(ctx, out, "\n"); ++ fz_drop_path(ctx, path); ++ } + } +- else ++ else if (fz_font_t3_procs(ctx, span->font)) + { + rect = fz_bound_glyph(ctx, span->font, gid, fz_identity); + shift.e = -rect.x0; + shift.f = -rect.y0; +- out = start_def(ctx, sdev); +- fz_write_printf(ctx, out, "\n", fnt->id, gid); + fz_run_t3_glyph(ctx, span->font, gid, shift, dev); + } + fz_write_printf(ctx, out, "\n"); +-- +2.19.1.1238.g4b45f61cc0 + diff --git a/mupdf-gl.desktop b/mupdf-gl.desktop new file mode 100644 index 0000000..4b6590f --- /dev/null +++ b/mupdf-gl.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Mupdf-GL +GenericName=PDF file viewer +Comment=Lightweight PDF file viewer written on portable C +Exec=mupdf-gl %f +Icon=mupdf-gl +Terminal=false +Type=Application +Categories=Viewer;Graphics; +MimeType=application/pdf;application/x-pdf; diff --git a/mupdf-no-strip.patch b/mupdf-no-strip.patch index 15d0535..bfa5e13 100644 --- a/mupdf-no-strip.patch +++ b/mupdf-no-strip.patch @@ -1,15 +1,14 @@ -Index: mupdf-1.12.0-source/Makerules -=================================================================== ---- mupdf-1.12.0-source.orig/Makerules -+++ mupdf-1.12.0-source/Makerules -@@ -25,8 +25,8 @@ ifeq "$(build)" "debug" - CFLAGS += -pipe -g - LDFLAGS += -g - else ifeq "$(build)" "release" --CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer --LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s -+CFLAGS += -pipe -O2 -DNDEBUG -+LDFLAGS += $(LDREMOVEUNREACH) - else ifeq "$(build)" "small" - CFLAGS += -pipe -Os -DNDEBUG -fomit-frame-pointer - LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s +diff -rub mupdf-1.14.0-source-orig/Makerules mupdf-1.14.0-source/Makerules +--- mupdf-1.14.0-source-orig/Makerules 2018-10-04 12:19:28.000000000 +0300 ++++ mupdf-1.14.0-source/Makerules 2019-03-11 16:22:57.232767035 +0200 +@@ -24,8 +24,8 @@ + CFLAGS += -pipe -g + LDFLAGS += -g $(LDREMOVEUNREACH) + else ifeq ($(build),release) +- CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer +- LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s ++ CFLAGS += -pipe -O2 -DNDEBUG ++ LDFLAGS += $(LDREMOVEUNREACH) + else ifeq ($(build),small) + CFLAGS += -pipe -Os -DNDEBUG -fomit-frame-pointer + LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s diff --git a/mupdf.changes b/mupdf.changes index b9284f4..95a8ea4 100644 --- a/mupdf.changes +++ b/mupdf.changes @@ -1,3 +1,62 @@ +------------------------------------------------------------------- +Mon Mar 11 14:26:01 UTC 2019 - Yunhe Guo + +- Add build dependencies: + * liblcms2-devel + * Mesa-libGL-devel + * freeglut-devel + * pkgconfig(openssl) + * pkgconfig(xi) + * pkgconfig(xrandr) +- Change COPYING to %licnese instead of %doc +- Update mupdf-no-strip.patch +- Add patches from Fedora project: + * mupdf-CVE-2018-16647.patch + * mupdf-CVE-2018-16648.patch + * mupdf-CVE-2018-18662.patch + * 0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch + * 0001-Write-placeholder-appearance-streams-for-digital-sig.patch + * 0001-fix-build-on-big-endian.patch +- Update to version 1.14: + * New features: + * Added "Source Han Serif" CJK fallback font. + * Added more scripts to the Noto fallback fonts. + * Multi-page PNM support. + * "mutool show" now supports a path syntax for selecting objects to show. + * Build system simplifications: + * Auto-generated CMap, ICC, and JS source files are checked in to git. + * Embedded CMap resources are now generated by a python script. + * Embedded font resources are linked directly if using GNU ld or windows. + * Namegen tool replaced by use of C macros. + * Simplified Makefile. + * Annotation editing: + * New annotation editing mode in mupdf-gl. + * Can create, edit, and delete most annotation types. + * Can create appearance streams for most annotation types. + * Can create appearance streams for Tx form fields. + * Can create appearance streams for Ch form fields. + * Form filling in mupdf-gl: + * Can click buttons, checkboxes, and radioboxes. + * Can fill out text fields using dialog box. + * Can select choice options using dialog box. + * Can verify and sign digital signatures. + * Improved UI for mupdf-gl: + * Password dialog. + * Error dialog. + * Open/save file dialog. + * Snap selection to words or lines by holding control or control+shift. + * Save and restore current location, bookmarks, and navigation history. + * Bug fixes: + * Improved CJK character fallback handling in EPUB. + * API changes: + * Pass rectangle and matrix structs by value. + * Replaced PDF_NAME_Xxx macros with PDF_NAME(Xxx). + * Added PDF_TRUE, PDF_FALSE, and PDF_NULL constant pdf_obj* macros. + * Added helper functions: pdf_dict_get_int, etc. + * Removed 'doc' argument in pdf_new_int, etc. + * Quads instead of rects when highlighting and searching text. + * mutool run: Pass arguments to script in scriptArgs global. + ------------------------------------------------------------------- Mon Apr 23 14:10:10 UTC 2018 - jengelh@inai.de diff --git a/mupdf.desktop b/mupdf.desktop index db244b7..95035b7 100644 --- a/mupdf.desktop +++ b/mupdf.desktop @@ -1,11 +1,11 @@ [Desktop Entry] -Encoding=UTF-8 -Name=MuPDF +Name=Mupdf GenericName=PDF file viewer -Comment=PDF file viewer -Exec=mupdf %f +Comment=Lightweight PDF file viewer written on portable C +Exec=mupdf-x11 %f Icon=mupdf +Terminal=false Type=Application -MimeType=application/pdf;application/x-pdf; Categories=Viewer;Graphics; +MimeType=application/pdf;application/x-pdf; NoDisplay=true diff --git a/mupdf.png b/mupdf.png deleted file mode 100644 index d71b2aa..0000000 --- a/mupdf.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bf2f0a2f58ae6c08bd488e353911c47be0a2ea4627b5d748ea916a75ec944712 -size 73084 diff --git a/mupdf.spec b/mupdf.spec index 03af3c9..bb478a0 100644 --- a/mupdf.spec +++ b/mupdf.spec @@ -1,7 +1,7 @@ # # spec file for package mupdf # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2011 Guido Berhoerster. # # All modifications and additions to the file contributed by third parties @@ -13,21 +13,29 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: mupdf -Version: 1.13.0 +Version: 1.14.0 Release: 0 Summary: PDF and XPS Viewer and Parser and Rendering Library License: AGPL-3.0-or-later Group: Productivity/Office/Other Url: https://mupdf.com/ -Source0: https://mupdf.com/downloads/mupdf-%{version}-source.tar.xz#/%{name}-%{version}.tar.xz -Source1: mupdf.desktop -Source2: mupdf.png +Source0: https://mupdf.com/downloads/mupdf-%{version}-source.tar.xz +Source1: %{name}.desktop +Source2: %{name}-gl.desktop Patch0: mupdf-no-strip.patch +Patch1: mupdf-CVE-2018-16647.patch +Patch2: mupdf-CVE-2018-16648.patch +Patch3: mupdf-CVE-2018-18662.patch +Patch4: 0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch +Patch5: 0001-Write-placeholder-appearance-streams-for-digital-sig.patch +Patch6: 0001-fix-build-on-big-endian.patch +BuildRequires: Mesa-libGL-devel +BuildRequires: freeglut-devel BuildRequires: freetype2-devel BuildRequires: gcc-c++ BuildRequires: jbig2dec-devel @@ -38,8 +46,12 @@ BuildRequires: pkgconfig BuildRequires: update-desktop-files BuildRequires: zlib-devel BuildRequires: pkgconfig(harfbuzz) +BuildRequires: pkgconfig(lcms2) +BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xi) +BuildRequires: pkgconfig(xrandr) Requires: xdg-utils %description @@ -64,46 +76,51 @@ based on mupdf. %prep %setup -q -n %{name}-%{version}-source -%patch0 -p1 -# do not use the inlined copies of build dpendencies except for mujs -rm -rf $(ls -d thirdparty/*/ | grep -v mujs) -for src in docs/*.c; do - if [ -r "$src" ]; then - ln -s "$src" "docs/examples/${src##*/}" - fi +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 -d thirdparty/lcms2 + +for d in $(ls thirdparty | grep -v -e freeglut -e lcms2 -e mujs) +do + rm -rf thirdparty/$d done -sed -e s,'INSTALL_APPS := .*','INSTALL_APPS := $(MUTOOL_EXE) $(MUVIEW_X11_CURL_EXE)', \ - -e '/^INSTALL_APPS +=/d' -i Makefile +echo > user.make "\ + USE_SYSTEM_FREETYPE := yes + USE_SYSTEM_HARFBUZZ := yes + USE_SYSTEM_JBIG2DEC := yes + USE_SYSTEM_JPEGXR := yes # not used without HAVE_JPEGXR + USE_SYSTEM_LCMS2 := no # need lcms2-art fork + USE_SYSTEM_LIBJPEG := yes + USE_SYSTEM_MUJS := no # build needs source anyways + USE_SYSTEM_OPENJPEG := yes + USE_SYSTEM_ZLIB := yes + USE_SYSTEM_GLUT := no # need freeglut2-art frok + USE_SYSTEM_CURL := yes +" %build -# do no set CFLAGS which is used by the build system itself! -export XCFLAGS="%{optflags} -fPIC -pthread" -make %{?_smp_mflags} \ - build=release \ - verbose=yes \ - NOCURL= \ - CURL_CFLAGS="$(pkg-config --libs libcurl)" \ - CURL_LIBS=" -pthread $(pkg-config --libs libcurl)" \ - HAVE_GLFW=no +export XCFLAGS="%{optflags} -fPIC -DJBIG_NO_MEMENTO -DTOFU -DTOFU_CJK" +make %{?_smp_mflags} build=release verbose=yes %install %make_install build=release prefix=%{_prefix} libdir=%{_libdir} - -mv %{buildroot}%{_bindir}/mupdf-x11-curl %{buildroot}%{_bindir}/mupdf - -rm -rf %{buildroot}%{_datadir}/doc/ - -chmod 0644 %{buildroot}%{_includedir}/mupdf/*.h \ - %{buildroot}%{_includedir}/mupdf/*/*.h \ - %{buildroot}%{_libdir}/*.a \ - %{buildroot}%{_mandir}/man1/* - -install -D -p -m 644 %{SOURCE1} \ - %{buildroot}%{_datadir}/applications/%{name}.desktop -install -D -p -m 644 %{SOURCE2} \ - %{buildroot}%{_datadir}/pixmaps/%{name}.png +rm -rf %{buildroot}%{_datadir}/doc/%{name} +desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1} +desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE2} +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps +install -p -m644 docs/logo/mupdf-logo.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/mupdf.svg +install -p -m644 docs/logo/mupdf-logo.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/mupdf-gl.svg +## fix strange permissons +chmod 0644 %{buildroot}%{_libdir}/*.a +find %{buildroot}/%{_mandir} -type f -exec chmod 0644 {} \; +find %{buildroot}/%{_includedir} -type f -exec chmod 0644 {} \; +cd %{buildroot}/%{_bindir} && ln -s %{name}-x11 %{name} %suse_update_desktop_file mupdf @@ -116,18 +133,18 @@ install -D -p -m 644 %{SOURCE2} \ %endif %files -%doc CHANGES COPYING README -%doc docs/examples/ -%{_bindir}/mupdf -%{_bindir}/mutool -%{_datadir}/applications/mupdf.desktop -%{_datadir}/pixmaps/mupdf.png -%{_mandir}/man1/mupdf.1%{ext_man} -%{_mandir}/man1/mutool.1%{ext_man} +%doc README CHANGES docs/* +%license COPYING +%{_bindir}/* +%{_datadir}/applications/mupdf*.desktop +%{_datadir}/icons/hicolor +%{_datadir}/icons/hicolor/scalable +%{_datadir}/icons/hicolor/scalable/apps +%{_datadir}/icons/hicolor/scalable/apps/* +%{_mandir}/man1/*.1.gz %files devel-static -%{_includedir}/mupdf/ -%{_libdir}/libmupdf.a -%{_libdir}/libmupdfthird.a +%{_includedir}/%{name} +%{_libdir}/lib%{name}*.a %changelog