From ae81195dba9b025ff3c642d773c7a58ed4e86a4f Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Tue, 7 Aug 2018 14:21:05 +0200 Subject: [PATCH] Fix tiling patterns when pattern cell is too far Resolves: #1557355 --- poppler-0.63.0-tiling-patterns.patch | 47 ++++++++++++++++++++++++++++ poppler.spec | 9 +++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 poppler-0.63.0-tiling-patterns.patch diff --git a/poppler-0.63.0-tiling-patterns.patch b/poppler-0.63.0-tiling-patterns.patch new file mode 100644 index 0000000..ea17a49 --- /dev/null +++ b/poppler-0.63.0-tiling-patterns.patch @@ -0,0 +1,47 @@ +From 718d428984e3a84fda521c0f5e6d975c7390af2b Mon Sep 17 00:00:00 2001 +From: Marek Kasik +Date: Fri, 6 Apr 2018 15:06:46 +0200 +Subject: [PATCH] cairo: Fix tiling patterns when pattern cell is too far + +Rendering of tiling pattern which has pattern matrix moving pattern cell +far away can fail on allocation of memory. This commit solves the issue by +modifying of cairo pattern matrix so that its offset is closer to the path +filled by the pattern. + +https://bugs.freedesktop.org/show_bug.cgi?id=105905 +--- + poppler/CairoOutputDev.cc | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc +index 631ab27b..b2e730bf 100644 +--- a/poppler/CairoOutputDev.cc ++++ b/poppler/CairoOutputDev.cc +@@ -915,6 +915,8 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat + StrokePathClip *strokePathTmp; + GBool adjusted_stroke_width_tmp; + cairo_pattern_t *maskTmp; ++ double xoffset, yoffset; ++ double det; + + width = bbox[2] - bbox[0]; + height = bbox[3] - bbox[1]; +@@ -976,6 +978,15 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat + if (cairo_pattern_status (pattern)) + return gFalse; + ++ det = pmat[0] * pmat[3] - pmat[1] * pmat[2]; ++ if (fabs(det) < 0.000001) ++ return gFalse; ++ ++ xoffset = round ((pmat[3] * pmat[4] - pmat[2] * pmat[5]) / (xStep * det)); ++ yoffset = - round ((pmat[1] * pmat[4] - pmat[0] * pmat[5]) / (yStep * det)); ++ pattern_matrix.x0 -= xoffset * pattern_matrix.xx * xStep + yoffset * pattern_matrix.xy * yStep; ++ pattern_matrix.y0 -= xoffset * pattern_matrix.yx * xStep + yoffset * pattern_matrix.yy * yStep; ++ + state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); + cairo_rectangle (cairo, xMin, yMin, xMax - xMin, yMax - yMin); + +-- +2.14.3 + diff --git a/poppler.spec b/poppler.spec index e1739c9..0c2b65d 100644 --- a/poppler.spec +++ b/poppler.spec @@ -4,7 +4,7 @@ Summary: PDF rendering library Name: poppler Version: 0.63.0 -Release: 7%{?dist} +Release: 8%{?dist} License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT URL: http://poppler.freedesktop.org/ Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz @@ -23,6 +23,9 @@ Patch4: poppler-0.63.0-python3.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1602838 Patch5: poppler-0.63.0-negative-object-number.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1557355 +Patch6: poppler-0.63.0-tiling-patterns.patch + BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gettext-devel @@ -253,6 +256,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}" %{_mandir}/man1/* %changelog +* Tue Aug 7 2018 Marek Kasik - 0.63.0-8 +- Fix tiling patterns when pattern cell is too far +- Resolves: #1557355 + * Tue Jul 31 2018 Florian Weimer - 0.63.0-7 - Rebuild with fixed binutils