Subject: [alpine-aports] [PATCH] main/cairo: fix PDF printing

From: Paul Bredbury <[email-masked]>
Date: Sun, 17 Mar 2019 12:21:28 +0000

---
 main/cairo/APKBUILD        |  6 ++++--
 main/cairo/pdf-flush.patch | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 main/cairo/pdf-flush.patch

diff --git a/main/cairo/APKBUILD b/main/cairo/APKBUILD
index a081d8f580..d15bd16726 100644
--- a/main/cairo/APKBUILD
+++ b/main/cairo/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=cairo
 pkgver=1.16.0
-pkgrel=1
+pkgrel=2
 pkgdesc="A vector graphics library"
 url="https://cairographics.org/"
 arch="all"
@@ -15,6 +15,7 @@ subpackages="$pkgname-dev $pkgname-doc $pkgname-gobject $pkgname-tools $pkgname-
 source="https://cairographics.org/releases/cairo-$pkgver.tar.xz
 	musl-stacksize.patch
 	CVE-2018-19876.patch
+	pdf-flush.patch
 	"
 builddir="$srcdir/$pkgname-$pkgver"
 
@@ -68,4 +69,5 @@ tools() {
 
 sha512sums="9eb27c4cf01c0b8b56f2e15e651f6d4e52c99d0005875546405b64f1132aed12fbf84727273f493d84056a13105e065009d89e94a8bfaf2be2649e232b82377f  cairo-1.16.0.tar.xz
 86f26fe41deb5e14f553c999090d1ec1d92a534fa7984112c9a7f1d6c6a8f1b7bb735947e8ec3f26e817f56410efe8cc46c5e682f6a278d49b40a683513740e0  musl-stacksize.patch
-8f13cdcae0f134e04778cf5915f858fb8d5357a7e0a454791c93d1566935b985ec66dfe1683cd0b74a1cb44a130923d7a27cf006f3fc70b9bee93abd58a55aa3  CVE-2018-19876.patch"
+8f13cdcae0f134e04778cf5915f858fb8d5357a7e0a454791c93d1566935b985ec66dfe1683cd0b74a1cb44a130923d7a27cf006f3fc70b9bee93abd58a55aa3  CVE-2018-19876.patch
+533ea878dc7f917af92e2694bd3f535a09cde77f0ecd0cc00881fbc9ec1ea86f60026eacc76129705f525f6672929ad8d15d8cfe1bfa61e9962e805a7fbded81  pdf-flush.patch"
diff --git a/main/cairo/pdf-flush.patch b/main/cairo/pdf-flush.patch
new file mode 100644
index 0000000000..c6e2251a51
--- /dev/null
+++ b/main/cairo/pdf-flush.patch
@@ -0,0 +1,33 @@
+From https://cgit.freedesktop.org/cairo/commit/?id=4c8813f0eaacc32c27126ad2296951a626300b89
+
+Fixes https://gitlab.freedesktop.org/cairo/cairo/issues/342
+
+From 4c8813f0eaacc32c27126ad2296951a626300b89 Mon Sep 17 00:00:00 2001
+From: Adrian Johnson <[email-masked]>
+Date: Thu, 25 Oct 2018 18:46:17 +1030
+Subject: pdf: add missing flush
+
+Issue #342
+---
+ src/cairo-pdf-surface.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
+index 7eb61aa..939b2d2 100644
+--- a/src/cairo-pdf-surface.c
++++ b/src/cairo-pdf-surface.c
+@@ -7711,6 +7711,11 @@ _cairo_pdf_surface_mask (void			*abstract_surface,
+      * and most common, case to handle. */
+     if (_cairo_pattern_is_constant_alpha (mask, &extents.bounded, &alpha) &&
+ 	_can_paint_pattern (source)) {
++
++	status = _cairo_pdf_operators_flush (&surface->pdf_operators);
++	if (unlikely (status))
++	    goto cleanup;
++
+ 	_cairo_output_stream_printf (surface->output, "q\n");
+ 	status = _cairo_pdf_surface_paint_pattern (surface,
+ 						   op,
+-- 
+cgit v1.1
+
-- 
2.21.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---