gnu: poppler: Update to 0.72.0.

* gnu/packages/patches/poppler-CVE-2018-19149.patch: Delete file.
* gnu/packages/patches/inkscape-poppler-compat3.patch,
gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch,
gnu/packages/patches/texlive-bin-pdftex-poppler-compat.patch,
gnu/packages/patches/texlive-bin-xetex-poppler-compat.patch: New files.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/pdf.scm (poppler): Update to 0.72.0.
[replacement]: Remove field.
(poppler/fixed): Remove variable.
* gnu/packages/inkscape.scm (inkscape)[source](patches): Add
'inkscape-poppler-compat{3..5}.patch'.
* gnu/packages/tex.scm (texlive-bin)[source](patches): Update
'texlive-poppler-compat.patch'.  Add
'texlive-bin-{lua,pdf,xe}tex-poppler-compat.patch'.
* gnu/packages/emacs.scm (emacs-pdf-tools)[source](modules, snippet): New
fields.
* gnu/packages/scribus.scm (scribus)[source](patches): Add upstream patch origins.
[source](modules, snippet): New fields.
* gnu/packages/libreoffice.scm (libreoffice)[source](patches): Add three
upstream origins.
[source](snippet, modules): New field.
This commit is contained in:
Marius Bakke 2018-12-09 00:40:05 +01:00
parent 127a14e0a6
commit 143fc1a591
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
12 changed files with 1169 additions and 100 deletions

View File

@ -832,6 +832,7 @@ dist_patch_DATA = \
%D%/packages/patches/icedtea-7-hotspot-gcc-segfault-workaround.patch \
%D%/packages/patches/id3lib-CVE-2007-4460.patch \
%D%/packages/patches/ilmbase-fix-tests.patch \
%D%/packages/patches/inkscape-poppler-compat3.patch \
%D%/packages/patches/intltool-perl-compatibility.patch \
%D%/packages/patches/irrlicht-use-system-libs.patch \
%D%/packages/patches/isl-0.11.1-aarch64-support.patch \
@ -1061,7 +1062,6 @@ dist_patch_DATA = \
%D%/packages/patches/plink-endian-detection.patch \
%D%/packages/patches/plotutils-libpng-jmpbuf.patch \
%D%/packages/patches/podofo-cmake-3.12.patch \
%D%/packages/patches/poppler-CVE-2018-19149.patch \
%D%/packages/patches/portaudio-audacity-compat.patch \
%D%/packages/patches/portmidi-modular-build.patch \
%D%/packages/patches/postgresql-disable-resolve_symlinks.patch \
@ -1186,6 +1186,9 @@ dist_patch_DATA = \
%D%/packages/patches/teeworlds-use-latest-wavpack.patch \
%D%/packages/patches/texinfo-perl-compat.patch \
%D%/packages/patches/texinfo-5-perl-compat.patch \
%D%/packages/patches/texlive-bin-luatex-poppler-compat.patch \
%D%/packages/patches/texlive-bin-pdftex-poppler-compat.patch \
%D%/packages/patches/texlive-bin-xetex-poppler-compat.patch \
%D%/packages/patches/telegram-purple-adjust-test.patch \
%D%/packages/patches/texi2html-document-encoding.patch \
%D%/packages/patches/texi2html-i18n.patch \

View File

@ -1634,7 +1634,15 @@ filters, new key bindings and faces. It can be enabled by
(sha256
(base32
"1i4647vax5na73basc5dz4lh9kprir00fh8ps4i0l1y3ippnjs2s"))
(patches (search-patches "emacs-pdf-tools-poppler.patch"))))
(patches (search-patches "emacs-pdf-tools-poppler.patch"))
(modules '((guix build utils)))
(snippet
'(begin
;; In addition to the above patch, we need this additional
;; provision for compatibility with Poppler 0.72:
(substitute* "server/poppler-hack.cc"
(("getCString") "c_str"))
#t))))
(build-system gnu-build-system)
(arguments
`(#:tests? #f ; there are no tests

View File

@ -71,7 +71,24 @@
(file-name "inkscape-poppler-compat2.patch")
(sha256
(base32
"14k9yrfjz4nx3bz9dk91q74mc0i7rvl2qzkwhcy1br71yqjvngn5")))))))
"14k9yrfjz4nx3bz9dk91q74mc0i7rvl2qzkwhcy1br71yqjvngn5")))
(search-patch "inkscape-poppler-compat3.patch")
(origin
(method url-fetch)
(uri (string-append "https://gitlab.com/inkscape/inkscape/commit/"
"d047859d90cef3784e2d13e40887a70d8d517897.diff"))
(file-name "inkscape-poppler-compat4.patch")
(sha256
(base32
"0xdfg3q4g4m15z7wna4brjn5j4kr15qiqc2f25vcw2nnr6x54qcp")))
(origin
(method url-fetch)
(uri (string-append "https://gitlab.com/inkscape/inkscape/commit/"
"b3d59cc8106da3bf6020a6c47eeb3b8a7bbae1a9.diff"))
(file-name "inkscape-poppler-compat5.patch")
(sha256
(base32
"0haviy66q9szizmvb82msfj80bb3wgi1fnq3ml8fyfp8l90a1217")))))))
(build-system cmake-build-system)
(inputs
`(("aspell" ,aspell)

View File

@ -984,9 +984,47 @@ converting QuarkXPress file format. It supports versions 3.1 to 4.1.")
(file-name "libreoffice-mdds.patch")
(sha256
(base32
"0apbmammmp4pk473xiv5vk50r4c5gjvqzf9jkficksvz58q6114f"))))
"0apbmammmp4pk473xiv5vk50r4c5gjvqzf9jkficksvz58q6114f")))
;; The Poppler API changed rapidly in the versions leading 0.72.
;; Thus, we need several patches from upstream, each adapting to
;; different Poppler changes since version 0.68.
(origin
(method url-fetch)
(uri (string-append "https://github.com/LibreOffice/core/commit/"
"1688a395d05125b83eac6cd5c43f0e3f2f66c491"
".patch"))
(file-name "libreoffice-poppler-compat.patch")
(sha256
(base32
"0ia5avmj772mrgs6m4qqf01hs8hzpy3nafidj7w7gqx2zz2s5ih9")))
(origin
(method url-fetch)
(uri (string-append "https://github.com/LibreOffice/core/commit/"
"5e8bdd9203dd642111c62a6668ee665a20d4ba19"
".patch"))
(file-name "libreoffice-poppler-gbool.patch")
(sha256
(base32
"19kc74h5vnk48l2vny8zmm2lkxpwc7g8n9d3wwpg99748dvbmikd")))
(origin
(method url-fetch)
(uri (string-append "https://github.com/LibreOffice/core/commit/"
"8ff41a26caf51544699863c89598d37d93dc1b21"
".patch"))
(file-name "libreoffice-poppler-0.71.patch")
(sha256
(base32
"1dsd0gynjf7d6412dd2sx70xa2s8kld7ibyjdkwg5w9hhi2zxw2f"))))
(search-patches "libreoffice-icu.patch"
"libreoffice-glm.patch")))))
"libreoffice-glm.patch")))
(modules '((guix build utils)))
(snippet
'(begin
(for-each (lambda (file)
;; Adjust to renamed function in Poppler 0.72.
(substitute* file (("getCString") "c_str")))
(find-files "sdext/source/pdfimport/xpdfwrapper"))
#t))))
(build-system glib-or-gtk-build-system)
(native-inputs
`(("bison" ,bison)

View File

@ -0,0 +1,499 @@
Fix compatibility with Poppler >= 0.69.
This is a combination of these upstream commits:
https://gitlab.com/inkscape/inkscape/commit/722e121361d0f784083d10e897155b7d4e44e515
https://gitlab.com/inkscape/inkscape/commit/402c0274420fe39fd2f3393bc7d8d8879d436358
...with slight adjustments for the 0.92.3 release tarball.
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake
--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -116,18 +116,6 @@ if(ENABLE_POPPLER)
set(HAVE_POPPLER_GLIB ON)
endif()
endif()
- if(POPPLER_VERSION VERSION_GREATER "0.26.0" OR
- POPPLER_VERSION VERSION_EQUAL "0.26.0")
- set(POPPLER_EVEN_NEWER_COLOR_SPACE_API ON)
- endif()
- if(POPPLER_VERSION VERSION_GREATER "0.29.0" OR
- POPPLER_VERSION VERSION_EQUAL "0.29.0")
- set(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API ON)
- endif()
- if(POPPLER_VERSION VERSION_GREATER "0.58.0" OR
- POPPLER_VERSION VERSION_EQUAL "0.58.0")
- set(POPPLER_NEW_OBJECT_API ON)
- endif()
else()
set(ENABLE_POPPLER_CAIRO OFF)
endif()
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -793,7 +793,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
dlg->getImportSettings(prefs);
// Apply crop settings
- PDFRectangle *clipToBox = NULL;
+ _POPPLER_CONST PDFRectangle *clipToBox = NULL;
double crop_setting;
sp_repr_get_double(prefs, "cropTo", &crop_setting);
diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h
--- a/src/extension/internal/pdfinput/pdf-input.h
+++ b/src/extension/internal/pdfinput/pdf-input.h
@@ -15,6 +15,7 @@
#endif
#ifdef HAVE_POPPLER
+#include "poppler-transition-api.h"
#include <gtkmm/dialog.h>
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -36,6 +36,7 @@ extern "C" {
#include "pdf-parser.h"
#include "util/units.h"
+#include "glib/poppler-features.h"
#include "goo/gmem.h"
#include "goo/GooString.h"
#include "GlobalParams.h"
@@ -294,8 +295,8 @@ PdfParser::PdfParser(XRef *xrefA,
int /*pageNum*/,
int rotate,
Dict *resDict,
- PDFRectangle *box,
- PDFRectangle *cropBox) :
+ _POPPLER_CONST PDFRectangle *box,
+ _POPPLER_CONST PDFRectangle *cropBox) :
xref(xrefA),
builder(builderA),
subPage(gFalse),
@@ -317,7 +318,7 @@ PdfParser::PdfParser(XRef *xrefA,
builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"),
Inkscape::Util::Quantity::convert(state->getPageHeight(), "pt", "px"));
- double *ctm = state->getCTM();
+ const double *ctm = state->getCTM();
double scaledCTM[6];
for (int i = 0; i < 6; ++i) {
baseMatrix[i] = ctm[i];
@@ -352,7 +353,7 @@ PdfParser::PdfParser(XRef *xrefA,
PdfParser::PdfParser(XRef *xrefA,
Inkscape::Extension::Internal::SvgBuilder *builderA,
Dict *resDict,
- PDFRectangle *box) :
+ _POPPLER_CONST PDFRectangle *box) :
xref(xrefA),
builder(builderA),
subPage(gTrue),
@@ -571,7 +572,7 @@ const char *PdfParser::getPreviousOperator(unsigned int look_back) {
void PdfParser::execOp(Object *cmd, Object args[], int numArgs) {
PdfOperator *op;
- char *name;
+ const char *name;
Object *argPtr;
int i;
@@ -619,7 +620,7 @@ void PdfParser::execOp(Object *cmd, Object args[], int numArgs) {
(this->*op->func)(argPtr, numArgs);
}
-PdfOperator* PdfParser::findOp(char *name) {
+PdfOperator* PdfParser::findOp(const char *name) {
int a = -1;
int b = numOps;
int cmp = -1;
@@ -1751,7 +1752,7 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat,
GBool stroke, GBool eoFill) {
GfxShading *shading;
GfxPath *savedPath;
- double *ctm, *btm, *ptm;
+ const double *ctm, *btm, *ptm;
double m[6], ictm[6], m1[6];
double xMin, yMin, xMax, yMax;
double det;
@@ -1993,7 +1994,7 @@ void PdfParser::doFunctionShFill1(GfxFunctionShading *shading,
GfxColor color0M, color1M, colorM0, colorM1, colorMM;
GfxColor colors2[4];
double functionColorDelta = colorDeltas[pdfFunctionShading-1];
- double *matrix;
+ const double *matrix;
double xM, yM;
int nComps, i, j;
@@ -2173,7 +2174,7 @@ void PdfParser::doPatchMeshShFill(GfxPatchMeshShading *shading) {
}
}
-void PdfParser::fillPatch(GfxPatch *patch, int nComps, int depth) {
+void PdfParser::fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth) {
GfxPatch patch00 = blankPatch();
GfxPatch patch01 = blankPatch();
GfxPatch patch10 = blankPatch();
@@ -2581,7 +2582,11 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/)
}
}
+#if POPPLER_CHECK_VERSION(0,64,0)
void PdfParser::doShowText(const GooString *s) {
+#else
+void PdfParser::doShowText(GooString *s) {
+#endif
GfxFont *font;
int wMode;
double riseX, riseY;
@@ -2590,11 +2595,15 @@ void PdfParser::doShowText(const GooString *s) {
double x, y, dx, dy, tdx, tdy;
double originX, originY, tOriginX, tOriginY;
double oldCTM[6], newCTM[6];
- double *mat;
+ const double *mat;
Object charProc;
Dict *resDict;
Parser *oldParser;
+#if POPPLER_CHECK_VERSION(0,64,0)
+ const char *p;
+#else
char *p;
+#endif
int len, n, uLen;
font = state->getFont();
@@ -2630,7 +2639,7 @@ void PdfParser::doShowText(const GooString *s) {
double lineX = state->getLineX();
double lineY = state->getLineY();
oldParser = parser;
- p = g_strdup(s->getCString());
+ p = s->getCString();
len = s->getLength();
while (len > 0) {
n = font->getNextChar(p, len, &code,
@@ -2685,7 +2694,7 @@ void PdfParser::doShowText(const GooString *s) {
} else {
state->textTransformDelta(0, state->getRise(), &riseX, &riseY);
- p = g_strdup(s->getCString());
+ p = s->getCString();
len = s->getLength();
while (len > 0) {
n = font->getNextChar(p, len, &code,
@@ -2731,7 +2740,11 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/)
{
Object obj1, obj2, obj3, refObj;
- char *name = g_strdup(args[0].getName());
+#if POPPLER_CHECK_VERSION(0,64,0)
+ const char *name = args[0].getName();
+#else
+ char *name = args[0].getName();
+#endif
#if defined(POPPLER_NEW_OBJECT_API)
if ((obj1 = res->lookupXObject(name)).isNull()) {
#else
@@ -3656,7 +3669,6 @@ void PdfParser::opBeginImage(Object /*args*/[], int /*numArgs*/)
Stream *PdfParser::buildImageStream() {
Object dict;
Object obj;
- char *key;
Stream *str;
// build dictionary
@@ -3674,26 +3686,17 @@ Stream *PdfParser::buildImageStream() {
obj.free();
#endif
} else {
- key = copyString(obj.getName());
-#if defined(POPPLER_NEW_OBJECT_API)
- obj = parser->getObj();
-#else
- obj.free();
- parser->getObj(&obj);
-#endif
- if (obj.isEOF() || obj.isError()) {
- gfree(key);
+ Object obj2;
+ _POPPLER_CALL(obj2, parser->getObj);
+ if (obj2.isEOF() || obj2.isError()) {
+ _POPPLER_FREE(obj);
break;
}
-#if defined(POPPLER_NEW_OBJECT_API)
- dict.dictAdd(key, std::move(obj));
- }
- obj = parser->getObj();
-#else
- dict.dictAdd(key, &obj);
+ _POPPLER_DICTADD(dict, obj.getName(), obj2);
+ _POPPLER_FREE(obj);
+ _POPPLER_FREE(obj2);
}
- parser->getObj(&obj);
-#endif
+ _POPPLER_CALL(obj, parser->getObj);
}
if (obj.isEOF()) {
error(errSyntaxError, getPos(), "End of file in inline image");
diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h
--- a/src/extension/internal/pdfinput/pdf-parser.h
+++ b/src/extension/internal/pdfinput/pdf-parser.h
@@ -9,6 +9,7 @@
#define PDF_PARSER_H
#ifdef HAVE_POPPLER
+#include "poppler-transition-api.h"
#ifdef USE_GCC_PRAGMAS
#pragma interface
@@ -25,6 +26,7 @@ namespace Inkscape {
// TODO clean up and remove using:
using Inkscape::Extension::Internal::SvgBuilder;
+#include "glib/poppler-features.h"
#include "goo/gtypes.h"
#include "Object.h"
@@ -127,11 +129,14 @@ public:
// Constructor for regular output.
PdfParser(XRef *xrefA, SvgBuilder *builderA, int pageNum, int rotate,
- Dict *resDict, PDFRectangle *box, PDFRectangle *cropBox);
+ Dict *resDict,
+ _POPPLER_CONST PDFRectangle *box,
+ _POPPLER_CONST PDFRectangle *cropBox);
// Constructor for a sub-page object.
PdfParser(XRef *xrefA, Inkscape::Extension::Internal::SvgBuilder *builderA,
- Dict *resDict, PDFRectangle *box);
+ Dict *resDict,
+ _POPPLER_CONST PDFRectangle *box);
virtual ~PdfParser();
@@ -185,7 +190,7 @@ private:
void go(GBool topLevel);
void execOp(Object *cmd, Object args[], int numArgs);
- PdfOperator *findOp(char *name);
+ PdfOperator *findOp(const char *name);
GBool checkArg(Object *arg, TchkType type);
int getPos();
@@ -256,7 +261,7 @@ private:
double x2, double y2, GfxColor *color2,
int nComps, int depth);
void doPatchMeshShFill(GfxPatchMeshShading *shading);
- void fillPatch(GfxPatch *patch, int nComps, int depth);
+ void fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth);
void doEndPath();
// path clipping operators
@@ -287,7 +292,12 @@ private:
void opMoveShowText(Object args[], int numArgs);
void opMoveSetShowText(Object args[], int numArgs);
void opShowSpaceText(Object args[], int numArgs);
+#if POPPLER_CHECK_VERSION(0,64,0)
void doShowText(const GooString *s);
+#else
+ void doShowText(GooString *s);
+#endif
+
// XObject operators
void opXObject(Object args[], int numArgs);
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
new file mode 100644
--- /dev/null
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -0,0 +1,39 @@
+#ifndef SEEN_POPPLER_TRANSITION_API_H
+#define SEEN_POPPLER_TRANSITION_API_H
+
+#include <glib/poppler-features.h>
+
+#if POPPLER_CHECK_VERSION(0,70,0)
+#define _POPPLER_CONST const
+#else
+#define _POPPLER_CONST
+#endif
+
+#if POPPLER_CHECK_VERSION(0,69,0)
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(key, std::move(obj))
+#elif POPPLER_CHECK_VERSION(0,58,0)
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), std::move(obj))
+#else
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), &obj)
+#endif
+
+#if POPPLER_CHECK_VERSION(0,58,0)
+#define POPPLER_NEW_OBJECT_API
+#define _POPPLER_FREE(obj)
+#define _POPPLER_CALL(ret, func) (ret = func())
+#define _POPPLER_CALL_ARGS(ret, func, ...) (ret = func(__VA_ARGS__))
+#else
+#define _POPPLER_FREE(obj) (obj).free()
+#define _POPPLER_CALL(ret, func) (*func(&ret))
+#define _POPPLER_CALL_ARGS(ret, func, ...) (*func(__VA_ARGS__, &ret))
+#endif
+
+#if POPPLER_CHECK_VERSION(0, 29, 0)
+#define POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API
+#endif
+
+#if POPPLER_CHECK_VERSION(0, 25, 0)
+#define POPPLER_EVEN_NEWER_COLOR_SPACE_API
+#endif
+
+#endif
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -625,7 +625,7 @@ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_
if ( pattern != NULL ) {
if ( pattern->getType() == 2 ) { // Shading pattern
GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern);
- double *ptm;
+ const double *ptm;
double m[6] = {1, 0, 0, 1, 0, 0};
double det;
@@ -672,7 +672,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern,
Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern");
// Set pattern transform matrix
- double *p2u = tiling_pattern->getMatrix();
+ const double *p2u = tiling_pattern->getMatrix();
double m[6] = {1, 0, 0, 1, 0, 0};
double det;
det = _ttm[0] * _ttm[3] - _ttm[1] * _ttm[2]; // see LP Bug 1168908
@@ -698,7 +698,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern,
pattern_node->setAttribute("patternUnits", "userSpaceOnUse");
// Set pattern tiling
// FIXME: don't ignore XStep and YStep
- double *bbox = tiling_pattern->getBBox();
+ const double *bbox = tiling_pattern->getBBox();
sp_repr_set_svg_double(pattern_node, "x", 0.0);
sp_repr_set_svg_double(pattern_node, "y", 0.0);
sp_repr_set_svg_double(pattern_node, "width", bbox[2] - bbox[0]);
@@ -751,7 +751,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern,
*/
gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for_shading) {
Inkscape::XML::Node *gradient;
- Function *func;
+ _POPPLER_CONST Function *func;
int num_funcs;
bool extend0, extend1;
@@ -865,7 +865,7 @@ static bool svgGetShadingColorRGB(GfxShading *shading, double offset, GfxRGB *re
#define INT_EPSILON 8
bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
- Function *func) {
+ _POPPLER_CONST Function *func) {
int type = func->getType();
if ( type == 0 || type == 2 ) { // Sampled or exponential function
GfxRGB stop1, stop2;
@@ -877,9 +877,9 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh
_addStopToGradient(gradient, 1.0, &stop2, 1.0);
}
} else if ( type == 3 ) { // Stitching
- StitchingFunction *stitchingFunc = static_cast<StitchingFunction*>(func);
- double *bounds = stitchingFunc->getBounds();
- double *encode = stitchingFunc->getEncode();
+ auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func);
+ const double *bounds = stitchingFunc->getBounds();
+ const double *encode = stitchingFunc->getEncode();
int num_funcs = stitchingFunc->getNumFuncs();
// Add stops from all the stitched functions
@@ -890,7 +890,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh
svgGetShadingColorRGB(shading, bounds[i + 1], &color);
// Add stops
if (stitchingFunc->getFunc(i)->getType() == 2) { // process exponential fxn
- double expE = (static_cast<ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
+ double expE = (static_cast<_POPPLER_CONST ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
if (expE > 1.0) {
expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1
if (encode[2*i] == 0) { // normal sequence
@@ -1020,9 +1020,9 @@ void SvgBuilder::updateFont(GfxState *state) {
GfxFont *font = state->getFont();
// Store original name
if (font->getName()) {
- _font_specification = g_strdup(font->getName()->getCString());
+ _font_specification = font->getName()->getCString();
} else {
- _font_specification = (char*) "Arial";
+ _font_specification = "Arial";
}
// Prune the font name to get the correct font family name
@@ -1030,7 +1030,7 @@ void SvgBuilder::updateFont(GfxState *state) {
char *font_family = NULL;
char *font_style = NULL;
char *font_style_lowercase = NULL;
- char *plus_sign = strstr(_font_specification, "+");
+ const char *plus_sign = strstr(_font_specification, "+");
if (plus_sign) {
font_family = g_strdup(plus_sign + 1);
_font_specification = plus_sign + 1;
@@ -1148,7 +1148,7 @@ void SvgBuilder::updateFont(GfxState *state) {
Inkscape::CSSOStringStream os_font_size;
double css_font_size = _font_scaling * state->getFontSize();
if ( font->getType() == fontType3 ) {
- double *font_matrix = font->getFontMatrix();
+ const double *font_matrix = font->getFontMatrix();
if ( font_matrix[0] != 0.0 ) {
css_font_size *= font_matrix[3] / font_matrix[0];
}
@@ -1193,7 +1193,7 @@ void SvgBuilder::updateTextPosition(double tx, double ty) {
void SvgBuilder::updateTextMatrix(GfxState *state) {
_flushText();
// Update text matrix
- double *text_matrix = state->getTextMat();
+ const double *text_matrix = state->getTextMat();
double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] );
double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] );
double max_scale;
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h
--- a/src/extension/internal/pdfinput/svg-builder.h
+++ b/src/extension/internal/pdfinput/svg-builder.h
@@ -15,6 +15,7 @@
#endif
#ifdef HAVE_POPPLER
+#include "poppler-transition-api.h"
class SPDocument;
namespace Inkscape {
@@ -80,7 +81,7 @@ struct SvgGlyph {
bool style_changed; // Set to true if style has to be reset
SPCSSAttr *style;
int render_mode; // Text render mode
- char *font_specification; // Pointer to current font specification
+ const char *font_specification; // Pointer to current font specification
};
/**
@@ -174,7 +175,7 @@ private:
void _addStopToGradient(Inkscape::XML::Node *gradient, double offset,
GfxRGB *color, double opacity);
bool _addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
- Function *func);
+ _POPPLER_CONST Function *func);
gchar *_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxState *state,
bool is_stroke=false);
// Image/mask creation
@@ -202,7 +203,7 @@ private:
SPCSSAttr *_font_style; // Current font style
GfxFont *_current_font;
- char *_font_specification;
+ const char *_font_specification;
double _font_scaling;
bool _need_font_update;
Geom::Affine _text_matrix;

View File

@ -1,80 +0,0 @@
Fix CVE-2018-19149:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-19149
https://gitlab.freedesktop.org/poppler/poppler/issues/664
Patch copied from upstream source repository:
https://gitlab.freedesktop.org/poppler/poppler/commit/f162ecdea0dda5dbbdb45503c1d55d9afaa41d44
From f162ecdea0dda5dbbdb45503c1d55d9afaa41d44 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 20 Apr 2018 11:38:13 +0200
Subject: [PATCH] Fix crash on missing embedded file
Check whether an embedded file is actually present in the PDF
and show warning in that case.
https://bugs.freedesktop.org/show_bug.cgi?id=106137
https://gitlab.freedesktop.org/poppler/poppler/issues/236
---
glib/poppler-attachment.cc | 26 +++++++++++++++++---------
glib/poppler-document.cc | 3 ++-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc
index c6502e9d..11ba5bb5 100644
--- a/glib/poppler-attachment.cc
+++ b/glib/poppler-attachment.cc
@@ -111,17 +111,25 @@ _poppler_attachment_new (FileSpec *emb_file)
attachment->description = _poppler_goo_string_to_utf8 (emb_file->getDescription ());
embFile = emb_file->getEmbeddedFile();
- attachment->size = embFile->size ();
+ if (embFile != NULL && embFile->streamObject()->isStream())
+ {
+ attachment->size = embFile->size ();
- if (embFile->createDate ())
- _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
- if (embFile->modDate ())
- _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
+ if (embFile->createDate ())
+ _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
+ if (embFile->modDate ())
+ _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
- if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
- attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
- embFile->checksum ()->getLength ());
- priv->obj_stream = embFile->streamObject()->copy();
+ if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
+ attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
+ embFile->checksum ()->getLength ());
+ priv->obj_stream = embFile->streamObject()->copy();
+ }
+ else
+ {
+ g_warning ("Missing stream object for embedded file");
+ g_clear_object (&attachment);
+ }
return attachment;
}
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 83f6aea6..ea319344 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -670,7 +670,8 @@ poppler_document_get_attachments (PopplerDocument *document)
attachment = _poppler_attachment_new (emb_file);
delete emb_file;
- retval = g_list_prepend (retval, attachment);
+ if (attachment != NULL)
+ retval = g_list_prepend (retval, attachment);
}
return g_list_reverse (retval);
}
--
2.19.1

View File

@ -0,0 +1,318 @@
Fix LuaTeX compatibility with Poppler 0.72.
Upstream LuaTeX have moved from Poppler to "pplib" and thus upstream
fixes are unavailable. This is based on Arch Linux patches, with minor
changes for Poppler 0.72:
https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/texlive-bin&id=f1b424435c8fa31d9296c7a6dc17f939a8332780
diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
--- a/texk/web2c/luatexdir/image/pdftoepdf.w
+++ b/texk/web2c/luatexdir/image/pdftoepdf.w
@@ -35,7 +35,7 @@
extern void md5(Guchar *msg, int msgLen, Guchar *digest);
-static GBool isInit = gFalse;
+static bool isInit = false;
/* Maintain AVL tree of all PDF files for embedding */
@@ -363,10 +363,10 @@ void copyReal(PDF pdf, double d)
static void copyString(PDF pdf, GooString * string)
{
- char *p;
+ const char *p;
unsigned char c;
size_t i, l;
- p = string->getCString();
+ p = string->c_str();
l = (size_t) string->getLength();
if (pdf->cave)
pdf_out(pdf, ' ');
@@ -393,7 +393,7 @@ static void copyString(PDF pdf, GooString * string)
pdf->cave = true;
}
-static void copyName(PDF pdf, char *s)
+static void copyName(PDF pdf, const char *s)
{
pdf_out(pdf, '/');
for (; *s != 0; s++) {
@@ -468,14 +468,14 @@ static void copyObject(PDF pdf, PdfDocument * pdf_doc, Object * obj)
break;
/*
case objNum:
- GBool isNum() { return type == objInt || type == objReal; }
+ bool isNum() { return type == objInt || type == objReal; }
break;
*/
case objString:
copyString(pdf, (GooString *)obj->getString());
break;
case objName:
- copyName(pdf, (char *)obj->getName());
+ copyName(pdf, obj->getName());
break;
case objNull:
pdf_add_null(pdf);
@@ -531,22 +531,22 @@ static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
{
switch (pagebox_spec) {
case PDF_BOX_SPEC_MEDIA:
- return page->getMediaBox();
+ return (PDFRectangle *) page->getMediaBox();
break;
case PDF_BOX_SPEC_CROP:
- return page->getCropBox();
+ return (PDFRectangle *) page->getCropBox();
break;
case PDF_BOX_SPEC_BLEED:
- return page->getBleedBox();
+ return (PDFRectangle *) page->getBleedBox();
break;
case PDF_BOX_SPEC_TRIM:
- return page->getTrimBox();
+ return (PDFRectangle *) page->getTrimBox();
break;
case PDF_BOX_SPEC_ART:
- return page->getArtBox();
+ return (PDFRectangle *) page->getArtBox();
break;
default:
- return page->getMediaBox();
+ return (PDFRectangle *) page->getMediaBox();
break;
}
}
@@ -587,11 +587,11 @@ void read_pdf_info(image_dict * idict)
PDFRectangle *pagebox;
int pdf_major_version_found, pdf_minor_version_found;
float xsize, ysize, xorig, yorig;
- if (isInit == gFalse) {
+ if (isInit == false) {
if (!(globalParams))
globalParams = new GlobalParams();
- globalParams->setErrQuiet(gFalse);
- isInit = gTrue;
+ globalParams->setErrQuiet(false);
+ isInit = true;
}
if (img_type(idict) == IMG_TYPE_PDF)
pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL);
@@ -966,7 +966,7 @@ void epdf_free()
if (PdfDocumentTree != NULL)
avl_destroy(PdfDocumentTree, destroyPdfDocument);
PdfDocumentTree = NULL;
- if (isInit == gTrue)
+ if (isInit == true)
delete globalParams;
- isInit = gFalse;
+ isInit = false;
}
diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
--- a/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -240,7 +240,7 @@ static int l_new_Attribute(lua_State * L)
if (uobj->pd != NULL && uobj->pd->pc != uobj->pc)
pdfdoc_changed_error(L);
uout = new_Attribute_userdata(L);
- uout->d = new Attribute(n, nlen, (Object *)uobj->d);
+ uout->d = new Attribute((GooString)n, (Object *)uobj->d);
uout->atype = ALLOC_LEPDF;
uout->pc = uobj->pc;
uout->pd = uobj->pd;
@@ -439,7 +439,7 @@ static int l_new_Object(lua_State * L)
break;
case 1:
if (lua_isboolean (L,1)) {
- uout->d = new Object(lua_toboolean(L, 1)? gTrue : gFalse);
+ uout->d = new Object(lua_toboolean(L, 1)? true : false);
uout->atype = ALLOC_LEPDF;
uout->pc = 0;
uout->pd = NULL;
@@ -596,7 +596,7 @@ static int m_##in##_##function(lua_State * L) \
uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
if (uin->pd != NULL && uin->pd->pc != uin->pc) \
pdfdoc_changed_error(L); \
- o = ((in *) uin->d)->function(); \
+ o = (out *) ((in *) uin->d)->function(); \
if (o != NULL) { \
uout = new_##out##_userdata(L); \
uout->d = o; \
@@ -676,7 +676,7 @@ static int m_##in##_##function(lua_State * L) \
pdfdoc_changed_error(L); \
gs = (GooString *)((in *) uin->d)->function(); \
if (gs != NULL) \
- lua_pushlstring(L, gs->getCString(), gs->getLength()); \
+ lua_pushlstring(L, gs->c_str(), gs->getLength()); \
else \
lua_pushnil(L); \
return 1; \
@@ -911,7 +911,7 @@ static int m_Array_getString(lua_State * L)
if (i > 0 && i <= len) {
gs = new GooString();
if (((Array *) uin->d)->getString(i - 1, gs))
- lua_pushlstring(L, gs->getCString(), gs->getLength());
+ lua_pushlstring(L, gs->c_str(), gs->getLength());
else
lua_pushnil(L);
delete gs;
@@ -1063,7 +1063,7 @@ static int m_Catalog_getJS(lua_State * L)
if (i > 0 && i <= len) {
gs = ((Catalog *) uin->d)->getJS(i - 1);
if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
+ lua_pushlstring(L, gs->c_str(), gs->getLength());
else
lua_pushnil(L);
delete gs;
@@ -1125,12 +1125,12 @@ m_poppler_get_INT(Dict, getLength);
static int m_Dict_add(lua_State * L)
{
- char *s;
+ const char *s;
udstruct *uin, *uobj;
uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- s = copyString(luaL_checkstring(L, 2));
+ s = luaL_checkstring(L, 2);
uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d)));
return 0;
@@ -1378,7 +1378,7 @@ static int m_GooString__tostring(lua_State * L)
uin = (udstruct *) luaL_checkudata(L, 1, M_GooString);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- lua_pushlstring(L, ((GooString *) uin->d)->getCString(),
+ lua_pushlstring(L, ((GooString *) uin->d)->c_str(),
((GooString *) uin->d)->getLength());
return 1;
}
@@ -1527,9 +1527,9 @@ static int m_Object_initBool(lua_State * L)
pdfdoc_changed_error(L);
luaL_checktype(L, 2, LUA_TBOOLEAN);
if (lua_toboolean(L, 2) != 0)
- *((Object *) uin->d) = Object(gTrue);
+ *((Object *) uin->d) = Object(true);
else
- *((Object *) uin->d) = Object(gFalse);
+ *((Object *) uin->d) = Object(false);
return 0;
}
@@ -1814,7 +1814,7 @@ static int m_Object_getString(lua_State * L)
pdfdoc_changed_error(L);
if (((Object *) uin->d)->isString()) {
gs = (GooString *)((Object *) uin->d)->getString();
- lua_pushlstring(L, gs->getCString(), gs->getLength());
+ lua_pushlstring(L, gs->c_str(), gs->getLength());
} else
lua_pushnil(L);
return 1;
@@ -2051,7 +2051,7 @@ static int m_Object_dictAdd(lua_State * L)
pdfdoc_changed_error(L);
if (!((Object *) uin->d)->isDict())
luaL_error(L, "Object is not a Dict");
- ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d)));
+ ((Object *) uin->d)->dictAdd(s, std::move(*((Object *) uobj->d)));
return 0;
}
@@ -2470,9 +2470,9 @@ static int m_PDFDoc_getFileName(lua_State * L)
uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- gs = ((PdfDocument *) uin->d)->doc->getFileName();
+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->getFileName();
if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
+ lua_pushlstring(L, gs->c_str(), gs->getLength());
else
lua_pushnil(L);
return 1;
@@ -2559,9 +2559,9 @@ static int m_PDFDoc_readMetadata(lua_State * L)
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
- gs = ((PdfDocument *) uin->d)->doc->readMetadata();
+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->readMetadata();
if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
+ lua_pushlstring(L, gs->c_str(), gs->getLength());
else
lua_pushnil(L);
} else
@@ -2577,7 +2577,7 @@ static int m_PDFDoc_getStructTreeRoot(lua_State * L)
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
- obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
+ obj = (StructTreeRoot *) ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
uout = new_StructTreeRoot_userdata(L);
uout->d = obj;
uout->pc = uin->pc;
@@ -3038,12 +3038,12 @@ m_poppler_get_BOOL(Attribute, isHidden);
static int m_Attribute_setHidden(lua_State * L)
{
- GBool i;
+ bool i;
udstruct *uin;
uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- i = (GBool) lua_toboolean(L, 2);
+ i = (bool) lua_toboolean(L, 2);
((Attribute *) uin->d)->setHidden(i);
return 0;
}
@@ -3180,7 +3180,7 @@ static int m_StructElement_getParentRef(lua_State * L)
// Ref is false if the C++ functione return false
static int m_StructElement_getPageRef(lua_State * L)
{
- GBool b;
+ bool b;
Ref *r;
udstruct *uin, *uout;
uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
@@ -3226,16 +3226,16 @@ static int m_StructElement_setRevision(lua_State * L)
static int m_StructElement_getText(lua_State * L)
{
- GBool i;
+ bool i;
GooString *gs;
udstruct *uin;
uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- i = (GBool) lua_toboolean(L, 2);
+ i = (bool) lua_toboolean(L, 2);
gs = ((StructElement *) uin->d)->getText(i);
if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
+ lua_pushlstring(L, gs->c_str(), gs->getLength());
else
lua_pushnil(L);
return 1;
@@ -3321,7 +3321,7 @@ static int m_StructElement_findAttribute(lua_State * L)
{
Attribute::Type t;
Attribute::Owner o;
- GBool g;
+ bool g;
udstruct *uin, *uout;
const Attribute *a;
uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
@@ -3329,7 +3329,7 @@ static int m_StructElement_findAttribute(lua_State * L)
pdfdoc_changed_error(L);
t = (Attribute::Type) luaL_checkint(L,1);
o = (Attribute::Owner) luaL_checkint(L,2);
- g = (GBool) lua_toboolean(L, 3);
+ g = (bool) lua_toboolean(L, 3);
a = ((StructElement *) uin->d)->findAttribute(t,g,o);
if (a!=NULL){

View File

@ -0,0 +1,188 @@
Fix compatibility with Poppler 0.72.
These files are taken from the upstream "poppler0.72.0.cc" variants and
diffed against the "newpoppler" files from the 20180414 distribution.
See revision 49336:
https://tug.org/svn/texlive/trunk/Build/source/texk/web2c/pdftexdir/
--- a/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc 1970-01-01 01:00:00.000000000 +0100
+++ b/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc 2018-12-09 21:14:58.479732695 +0100
@@ -22,7 +22,7 @@
https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
by Arch Linux. A little modifications are made to avoid a crash for
some kind of pdf images, such as figure_missing.pdf in gnuplot.
-The poppler should be 0.59.0 or newer versions.
+The poppler should be 0.72.0 or newer versions.
POPPLER_VERSION should be defined.
*/
@@ -120,7 +120,7 @@
static InObj *inObjList;
static UsedEncoding *encodingList;
-static GBool isInit = gFalse;
+static bool isInit = false;
// --------------------------------------------------------------------
// Maintain list of open embedded PDF files
@@ -317,7 +317,7 @@
pdf_puts("<<\n");
assert(r->type == objFont); // FontDescriptor is in fd_tree
for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
- key = obj->dictGetKey(i);
+ key = (char *)obj->dictGetKey(i);
if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0
|| strncmp("BaseFont", key, strlen("BaseFont")) == 0
|| strncmp("Encoding", key, strlen("Encoding")) == 0)
@@ -427,7 +427,7 @@
charset = fontdesc.dictLookup("CharSet");
if (!charset.isNull() &&
charset.isString() && is_subsetable(fontmap))
- epdf_mark_glyphs(fd, (char *)charset.getString()->getCString());
+ epdf_mark_glyphs(fd, (char *)charset.getString()->c_str());
else
embed_whole_font(fd);
addFontDesc(fontdescRef.getRef(), fd);
@@ -454,7 +454,7 @@
for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
fontRef = obj->dictGetValNF(i);
if (fontRef.isRef())
- copyFont(obj->dictGetKey(i), &fontRef);
+ copyFont((char *)obj->dictGetKey(i), &fontRef);
else if (fontRef.isDict()) { // some programs generate pdf with embedded font object
copyName((char *)obj->dictGetKey(i));
pdf_puts(" ");
@@ -566,7 +566,7 @@
pdf_printf("%s", convertNumToPDF(obj->getNum()));
} else if (obj->isString()) {
s = (GooString *)obj->getString();
- p = s->getCString();
+ p = (char *)s->c_str();
l = s->getLength();
if (strlen(p) == (unsigned int) l) {
pdf_puts("(");
@@ -664,7 +664,7 @@
("PDF inclusion: CID fonts are not supported"
" (try to disable font replacement to fix this)");
}
- if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
+ if ((s = (char *)((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
glyphNames[i] = s;
else
glyphNames[i] = notdef;
@@ -683,7 +683,7 @@
}
// get the pagebox according to the pagebox_spec
-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
{
if (pagebox_spec == pdfboxspecmedia)
return page->getMediaBox();
@@ -715,7 +715,7 @@
{
PdfDocument *pdf_doc;
Page *page;
- PDFRectangle *pagebox;
+ const PDFRectangle *pagebox;
#ifdef POPPLER_VERSION
int pdf_major_version_found, pdf_minor_version_found;
#else
@@ -724,8 +724,8 @@
// initialize
if (!isInit) {
globalParams = new GlobalParams();
- globalParams->setErrQuiet(gFalse);
- isInit = gTrue;
+ globalParams->setErrQuiet(false);
+ isInit = true;
}
// open PDF file
pdf_doc = find_add_document(image_name);
@@ -849,7 +849,7 @@
pageObj = xref->fetch(pageRef->num, pageRef->gen);
pageDict = pageObj.getDict();
rotate = page->getRotate();
- PDFRectangle *pagebox;
+ const PDFRectangle *pagebox;
// write the Page header
pdf_puts("/Type /XObject\n");
pdf_puts("/Subtype /Form\n");
@@ -977,7 +977,7 @@
}
l = dic1.getLength();
for (i = 0; i < l; i++) {
- groupDict.dictAdd(copyString(dic1.getKey(i)),
+ groupDict.dictAdd((const char *)copyString(dic1.getKey(i)),
dic1.getValNF(i));
}
// end modification
@@ -1001,14 +1001,14 @@
pdf_puts("/Resources <<\n");
for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
obj2 = obj1->dictGetVal(i);
- key = obj1->dictGetKey(i);
+ key = (char *)obj1->dictGetKey(i);
if (strcmp("Font", key) == 0)
copyFontResources(&obj2);
else if (strcmp("ProcSet", key) == 0)
copyProcSet(&obj2);
else
- copyOtherResources(&obj2, key);
+ copyOtherResources(&obj2, (char *)key);
}
pdf_puts(">>\n");
}
--- a/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc 1970-01-01 01:00:00.000000000 +0100
+++ b/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc 2018-12-09 21:14:58.479732695 +0100
@@ -20,7 +20,7 @@
/*
This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
-by Arch Linux. The poppler should be 0.59.0 or newer versions.
+by Arch Linux. The poppler should be 0.72.0 or newer versions.
POPPLER_VERSION should be defined.
*/
@@ -109,7 +109,7 @@
fprintf(stderr, "No SourceName found\n");
exit(1);
}
- outname = (char *)srcName.getString()->getCString();
+ outname = (char *)srcName.getString()->c_str();
// We cannot free srcName, as objname shares its string.
// srcName.free();
} else if (objnum > 0) {
@@ -118,7 +118,7 @@
fprintf(stderr, "Not a Stream object\n");
exit(1);
}
- sprintf(buf, "%s", fileName->getCString());
+ sprintf(buf, "%s", fileName->c_str());
if ((p = strrchr(buf, '.')) == 0)
p = strchr(buf, 0);
if (objgen == 0)
@@ -128,7 +128,7 @@
outname = buf;
} else { // objnum < 0 means we are extracting the XRef table
extract_xref_table = true;
- sprintf(buf, "%s", fileName->getCString());
+ sprintf(buf, "%s", fileName->c_str());
if ((p = strrchr(buf, '.')) == 0)
p = strchr(buf, 0);
sprintf(p, ".xref");
@@ -173,9 +173,9 @@
// parse the header: object numbers and offsets
objStr.streamReset();
- str = new EmbedStream(objStr.getStream(), Object(objNull), gTrue, first);
+ str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
lexer = new Lexer(xref, str);
- parser = new Parser(xref, lexer, gFalse);
+ parser = new Parser(xref, lexer, false);
for (n = 0; n < nObjects; ++n) {
obj1 = parser->getObj();
obj2 = parser->getObj();

View File

@ -0,0 +1,31 @@
Fix compatibility with Poppler 0.72.
Patch taken from upstream:
https://tug.org/svn/texlive/trunk/Build/source/texk/web2c/xetexdir/pdfimage.cpp?r1=44964&r2=48969&diff_format=u
--- a/texk/web2c/xetexdir/pdfimage.cpp 2017/08/06 07:12:02 44964
+++ b/texk/web2c/xetexdir/pdfimage.cpp 2018/10/22 04:01:42 48969
@@ -82,19 +82,19 @@
switch (pdf_box) {
default:
case pdfbox_crop:
- r = page->getCropBox();
+ r = (PDFRectangle *)page->getCropBox();
break;
case pdfbox_media:
- r = page->getMediaBox();
+ r = (PDFRectangle *)page->getMediaBox();
break;
case pdfbox_bleed:
- r = page->getBleedBox();
+ r = (PDFRectangle *)page->getBleedBox();
break;
case pdfbox_trim:
- r = page->getTrimBox();
+ r = (PDFRectangle *)page->getTrimBox();
break;
case pdfbox_art:
- r = page->getArtBox();
+ r = (PDFRectangle *)page->getArtBox();
break;
}

View File

@ -82,15 +82,14 @@
(define-public poppler
(package
(name "poppler")
(replacement poppler/fixed)
(version "0.68.0")
(version "0.72.0")
(source (origin
(method url-fetch)
(uri (string-append "https://poppler.freedesktop.org/poppler-"
version ".tar.xz"))
(sha256
(base32
"0n0f7mv24lzv9p3dlzakpdhqg7ygcvl6l40grcz95xldzgq083gr"))))
"0lfs1b1jfamxl13zbl5n448dqvl9n8frbv8180y7b7kfyaw7wx61"))))
(build-system cmake-build-system)
;; FIXME:
;; use libcurl: no
@ -132,14 +131,6 @@
(license license:gpl2+)
(home-page "https://poppler.freedesktop.org/")))
(define poppler/fixed
(package
(inherit poppler)
(source (origin
(inherit (package-source poppler))
(patches (append (origin-patches (package-source poppler))
(search-patches "poppler-CVE-2018-19149.patch")))))))
(define-public poppler-data
(package
(name "poppler-data")

View File

@ -56,7 +56,59 @@
(sha256
(base32
"00ys0p6h3iq77kh72dkl0qrf7qvznq18qdrgiq10gfxja1995034"))
(patches (search-patches "scribus-poppler.patch"))))
(patches (append
;; Scribus relies heavily on Poppler internals, which have
;; changed a lot since the latest Scribus release (2018-04).
;; Thus, we require a bunch of patches to stay compatible.
(search-patches "scribus-poppler.patch")
(list (origin
(method url-fetch)
(uri (string-append
"https://github.com/scribusproject/scribus/commit/"
"7d4ceeb5cac32287769e3c0238699e0b3e56c24d.patch"))
(file-name "scribus-poppler-0.64.patch")
(sha256
(base32
"1kr27bfzkpabrh42nsrrvlqyycdg9isbavpaa5spgmrhidcg02xj")))
(origin
(method url-fetch)
(uri (string-append
"https://github.com/scribusproject/scribus/commit/"
"76561c1a55cd07c268f8f2b2fea888532933700b.patch"))
(file-name "scribus-poppler-config.patch")
(sha256
(base32
"01k18xjj82c3ndzp89dlpfhhdccc8z0acf8b04r592jyr5y9rc19")))
(origin
(method url-fetch)
(uri (string-append
"https://github.com/scribusproject/scribus/commit/"
"8e05d26c19097ac2ad5b4ebbf40a3771ee6faf9c.patch"))
(file-name "scribus-poppler-0.69.patch")
(sha256
(base32
"1avdmsj5l543j0irq18nxgiw99n395jj56ih5dsal59fn0wbqk42")))
(origin
(method url-fetch)
(uri (string-append "https://git.archlinux.org/svntogit/"
"community.git/plain/trunk/scribus-"
"poppler-0.70.patch?h=packages/scribus&id="
"8ef43ee2fceb0753ed5a76bb0a11c84775898ffc"))
(file-name "scribus-poppler-0.70.patch")
(sha256
(base32
"0dw7ix3jaj0y1q97cmmqwb2qgdx760yhxx86wa8rnx0xhfi5x6qr"))))))
(modules '((guix build utils)))
(snippet
'(begin
(for-each (lambda (file)
(substitute* file
;; These are required for compatibility with Poppler 0.71.
(("GBool") "bool") (("gTrue") "true") (("gFalse") "false")
;; ...and this for Poppler 0.72.
(("getCString") "c_str")))
(find-files "scribus/plugins/import/pdf"))
#t))))
(build-system cmake-build-system)
(arguments
`(#:tests? #f ;no test target

View File

@ -102,15 +102,19 @@
(patches
(list
;; This is required for compatibility with Poppler 0.64.0 and to fix a
;; segmentation fault in dvipdfm-x from XeTeX.
;; segmentation fault in dvipdfm-x from XeTeX, and also contains a fix
;; for CVE-2018-17407.
(origin
(method url-fetch)
(uri (string-append "http://www.linuxfromscratch.org/patches/blfs/"
"svn/texlive-" version "-source-upstream_fixes-1.patch"))
"svn/texlive-" version "-source-upstream_fixes-2.patch"))
(file-name "texlive-poppler-compat.patch")
(sha256
(base32
"0f8vhyj167y4xj0jx47vkybrcacfpxw0wdn1b777yq3xmhlahhlg")))))))
"04sxy1qv9y575mxwyg3y7rx7mh540pfjqx7yni7ncb5wjbq9pq1a")))
(search-patch "texlive-bin-luatex-poppler-compat.patch")
(search-patch "texlive-bin-pdftex-poppler-compat.patch")
(search-patch "texlive-bin-xetex-poppler-compat.patch")))))
(build-system gnu-build-system)
(inputs
`(("texlive-extra-src" ,texlive-extra-src)