summaryrefslogtreecommitdiff
path: root/app-text/poppler/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-11-26 11:42:28 +0000
committerV3n3RiX <venerix@redcorelinux.org>2017-11-26 11:42:28 +0000
commit89c6c06b8c42107dd231687a1012354e7d3039fc (patch)
treedad94f4da8a6694f3cb99f7048be2f9cf5f78f97 /app-text/poppler/files
parent796cae72cf9ed18ba01256ac1f83a686a2a76036 (diff)
gentoo resync : 26.11.2017
Diffstat (limited to 'app-text/poppler/files')
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch199
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch25
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch30
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch45
-rw-r--r--app-text/poppler/files/poppler-0.28.1-respect-cflags.patch48
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14517.patch27
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14518.patch27
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14519.patch100
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14520.patch24
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14617.patch31
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14926.patch36
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14927.patch32
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14928.patch69
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-14929.patch252
-rw-r--r--app-text/poppler/files/poppler-0.57.0-CVE-2017-15565.patch28
-rw-r--r--app-text/poppler/files/poppler-0.57.0-disable-internal-jpx.patch25
16 files changed, 651 insertions, 347 deletions
diff --git a/app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch b/app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch
deleted file mode 100644
index 2246b29b1340..000000000000
--- a/app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch
+++ /dev/null
@@ -1,199 +0,0 @@
-From e8fcbaca23878f0edd2015440eec55aaba0e8f9f Mon Sep 17 00:00:00 2001
-From: Paul Gideon Dann <pdgiddie@gmail.com>
-Date: Wed, 20 May 2009 11:42:28 +0100
-Subject: [PATCH 1/4] Cairo backend added to Qt4 wrapper
-
----
- qt4/src/CMakeLists.txt | 15 ++++++++++
- qt4/src/poppler-document.cc | 3 ++
- qt4/src/poppler-page.cc | 70 +++++++++++++++++++++++++++++++++++++++++++++
- qt4/src/poppler-qt4.h | 3 +-
- qt4/tests/CMakeLists.txt | 5 ++++
- 5 files changed, 95 insertions(+), 1 deletion(-)
-
-diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt
-index 189eca2..5338b55 100644
---- a/qt4/src/CMakeLists.txt
-+++ b/qt4/src/CMakeLists.txt
-@@ -6,6 +6,11 @@ include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}
- )
-
-+if (HAVE_CAIRO)
-+ include_directories(${CAIRO_INCLUDE_DIRS})
-+ add_definitions(${CAIRO_CFLAGS})
-+endif (HAVE_CAIRO)
-+
- set(poppler_qt4_SRCS
- poppler-annotation.cc
- poppler-document.cc
-@@ -28,10 +33,20 @@ set(poppler_qt4_SRCS
- poppler-media.cc
- ArthurOutputDev.cc
- )
-+if (HAVE_CAIRO)
-+ set(poppler_qt4_SRCS ${poppler_qt4_SRCS}
-+ ${CMAKE_SOURCE_DIR}/poppler/CairoOutputDev.cc
-+ ${CMAKE_SOURCE_DIR}/poppler/CairoRescaleBox.cc
-+ ${CMAKE_SOURCE_DIR}/poppler/CairoFontEngine.cc
-+ )
-+endif(HAVE_CAIRO)
- qt4_automoc(${poppler_qt4_SRCS})
- add_library(poppler-qt4 SHARED ${poppler_qt4_SRCS})
- set_target_properties(poppler-qt4 PROPERTIES VERSION 4.9.0 SOVERSION 4)
- target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBRARY} ${QT4_QTXML_LIBRARY})
-+if (HAVE_CAIRO)
-+ target_link_libraries(poppler-qt4 ${CAIRO_LIBRARIES})
-+endif (HAVE_CAIRO)
- if(MSVC)
- target_link_libraries(poppler-qt4 poppler ${poppler_LIBS})
- endif(MSVC)
-diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
-index 94f997d..6decaaf 100644
---- a/qt4/src/poppler-document.cc
-+++ b/qt4/src/poppler-document.cc
-@@ -547,6 +547,9 @@ namespace Poppler {
- ret << Document::SplashBackend;
- #endif
- ret << Document::ArthurBackend;
-+#if defined(HAVE_CAIRO)
-+ ret << Document::CairoBackend;
-+#endif
- return ret;
- }
-
-diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
-index 83bcf4a..df1d344 100644
---- a/qt4/src/poppler-page.cc
-+++ b/qt4/src/poppler-page.cc
-@@ -40,6 +40,7 @@
- #include <QtGui/QPainter>
-
- #include <config.h>
-+#include <math.h>
- #include <PDFDoc.h>
- #include <Catalog.h>
- #include <Form.h>
-@@ -53,6 +54,9 @@
- #include <SplashOutputDev.h>
- #include <splash/SplashBitmap.h>
- #endif
-+#if defined(HAVE_CAIRO)
-+#include <CairoOutputDev.h>
-+#endif
-
- #include "poppler-private.h"
- #include "poppler-page-transition-private.h"
-@@ -405,6 +409,70 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
- img = tmpimg;
- break;
- }
-+ case Poppler::Document::CairoBackend:
-+ {
-+#if defined(HAVE_CAIRO)
-+ CairoOutputDev *output_dev = new CairoOutputDev();
-+ output_dev->startDoc(m_page->parentDoc->doc);
-+ int buffer_width, buffer_height, rotate;
-+ cairo_surface_t *surface;
-+ cairo_t *cairo;
-+
-+ // If w or h are -1, that indicates the whole page, so we need to
-+ // calculate how many pixels that corresponds to. Otherwise, we can use w
-+ // or h directly for our buffer size.
-+ const QSize pageSize = this->pageSize();
-+ if (w == -1) {
-+ const double xscale = xres / 72.0;
-+ const double width = pageSize.width();;
-+ buffer_width = (int) ceil(width * xscale);
-+ } else {
-+ buffer_width = w;
-+ }
-+ if (h == -1) {
-+ const double yscale = yres / 72.0;
-+ const double height = pageSize.height();
-+ buffer_height = (int) ceil(height * yscale);
-+ } else {
-+ buffer_height = h;
-+ }
-+
-+ rotate = rotation + m_page->page->getRotate();
-+
-+ // FIXME: Okular never provides a rotation value, so I don't have any way
-+ // of testing this right now. The result is that subpixels are ordered
-+ // incorrectly when the page is rotated.
-+
-+ //if (rotate == 90 || rotate == 270) {
-+ // const double temp = height;
-+ // height = width;
-+ // width = temp;
-+ //}
-+
-+ img = QImage(buffer_width, buffer_height, QImage::Format_ARGB32);
-+ img.fill(Qt::white); // Never transparent
-+
-+ surface = cairo_image_surface_create_for_data(
-+ img.bits(),
-+ CAIRO_FORMAT_ARGB32,
-+ buffer_width, buffer_height,
-+ img.bytesPerLine());
-+
-+ cairo = cairo_create(surface);
-+ output_dev->setCairo(cairo);
-+
-+ m_page->parentDoc->doc->displayPageSlice(
-+ output_dev, m_page->index + 1, xres, yres, rotation, false, true,
-+ false, x, y, w, h);
-+
-+ // Clean up
-+ output_dev->setCairo(NULL);
-+ cairo_destroy(cairo);
-+ cairo_surface_destroy(surface);
-+ delete output_dev;
-+#endif
-+ break;
-+ }
- }
-
- return img;
-@@ -447,6 +515,8 @@ bool Page::renderToPainter(QPainter* painter, double xres, double yres, int x, i
- painter->restore();
- return true;
- }
-+ case Poppler::Document::CairoBackend:
-+ return false;
- }
- return false;
- }
-diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
-index c0340a4..118f8ba 100644
---- a/qt4/src/poppler-qt4.h
-+++ b/qt4/src/poppler-qt4.h
-@@ -886,7 +886,8 @@ delete it;
- */
- enum RenderBackend {
- SplashBackend, ///< Splash backend
-- ArthurBackend ///< Arthur (Qt4) backend
-+ ArthurBackend, ///< Arthur (Qt4) backend
-+ CairoBackend ///< Cairo backend
- };
-
- /**
-diff --git a/qt4/tests/CMakeLists.txt b/qt4/tests/CMakeLists.txt
-index bba868f..8c40471 100644
---- a/qt4/tests/CMakeLists.txt
-+++ b/qt4/tests/CMakeLists.txt
-@@ -8,6 +8,11 @@ include_directories(
- ${QT4_INCLUDE_DIR}
- )
-
-+if (HAVE_CAIRO)
-+ include_directories(${CAIRO_INCLUDE_DIRS})
-+ add_definitions(${CAIRO_CFLAGS})
-+endif (HAVE_CAIRO)
-+
- macro(QT4_ADD_SIMPLETEST exe source)
- string(REPLACE "-" "" test_name ${exe})
- set(${test_name}_SOURCES
---
-2.7.3
-
diff --git a/app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch b/app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch
deleted file mode 100644
index 3a360394182e..000000000000
--- a/app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 7ddcf7bf4296ed58dc316b0dd6b000057740e118 Mon Sep 17 00:00:00 2001
-From: Paul Gideon Dann <pdgiddie@gmail.com>
-Date: Wed, 20 May 2009 13:17:29 +0100
-Subject: [PATCH 2/4] Setting default Qt4 backend to Cairo
-
----
- qt4/src/poppler-private.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
-index cbf21b1..1c7f16c 100644
---- a/qt4/src/poppler-private.cc
-+++ b/qt4/src/poppler-private.cc
-@@ -236,7 +236,7 @@ namespace Debug {
- void DocumentData::init()
- {
- m_fontInfoIterator = 0;
-- m_backend = Document::SplashBackend;
-+ m_backend = Document::CairoBackend;
- paperColor = Qt::white;
- m_hints = 0;
- m_optContentModel = 0;
---
-2.7.3
-
diff --git a/app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch b/app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch
deleted file mode 100644
index 21547b951802..000000000000
--- a/app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From a9a6a3fcf4f2bf62e83d325a790624241084ad72 Mon Sep 17 00:00:00 2001
-From: Paul Gideon Dann <pdgiddie@gmail.com>
-Date: Wed, 20 May 2009 13:06:48 +0100
-Subject: [PATCH 3/4] Forcing subpixel rendering in Cairo backend
-
----
- poppler/CairoOutputDev.cc | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
-index d0d6cb4..50e64f9 100644
---- a/poppler/CairoOutputDev.cc
-+++ b/poppler/CairoOutputDev.cc
-@@ -203,6 +203,13 @@ void CairoOutputDev::setCairo(cairo_t *cairo)
- }
- if (cairo != NULL) {
- this->cairo = cairo_reference (cairo);
-+ {
-+ cairo_font_options_t *options = cairo_font_options_create ();
-+ cairo_get_font_options (cairo, options);
-+ cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_SUBPIXEL);
-+ cairo_set_font_options (cairo, options);
-+ cairo_font_options_destroy (options);
-+ }
- /* save the initial matrix so that we can use it for type3 fonts. */
- //XXX: is this sufficient? could we miss changes to the matrix somehow?
- cairo_get_matrix(cairo, &orig_matrix);
---
-2.7.3
-
diff --git a/app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch b/app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch
deleted file mode 100644
index 0f622323a9f0..000000000000
--- a/app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 1604ec6cb759b6f2b8aa006faa0ec990cd511b36 Mon Sep 17 00:00:00 2001
-From: Paul Gideon Dann <pdgiddie@gmail.com>
-Date: Thu, 21 May 2009 10:55:49 +0100
-Subject: [PATCH 4/4] Enabling slight hinting in Cairo Backend
-
-Originally suggested at:
-http://bugs.freedesktop.org/show_bug.cgi?id=3307#c20
----
- poppler/CairoFontEngine.cc | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
-index 3cff917..75a1c50 100644
---- a/poppler/CairoFontEngine.cc
-+++ b/poppler/CairoFontEngine.cc
-@@ -132,7 +132,7 @@ CairoFont::getSubstitutionCorrection(GfxFont *gfxFont)
- cairo_matrix_t m;
- cairo_matrix_init_identity(&m);
- cairo_font_options_t *options = cairo_font_options_create();
-- cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
-+ cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_SLIGHT);
- cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_OFF);
- cairo_scaled_font_t *scaled_font = cairo_scaled_font_create(cairo_font_face, &m, &m, options);
-
-@@ -189,7 +189,7 @@ _ft_new_face_uncached (FT_Library lib,
- }
-
- font_face = cairo_ft_font_face_create_for_ft_face (face,
-- FT_LOAD_NO_HINTING |
-+ FT_LOAD_TARGET_LIGHT |
- FT_LOAD_NO_BITMAP);
- if (cairo_font_face_set_user_data (font_face,
- &_ft_cairo_key,
-@@ -358,7 +358,7 @@ _ft_new_face (FT_Library lib,
- _ft_open_faces = l;
-
- l->font_face = cairo_ft_font_face_create_for_ft_face (tmpl.face,
-- FT_LOAD_NO_HINTING |
-+ FT_LOAD_TARGET_LIGHT |
- FT_LOAD_NO_BITMAP);
- if (cairo_font_face_set_user_data (l->font_face,
- &_ft_cairo_key,
---
-2.7.3
-
diff --git a/app-text/poppler/files/poppler-0.28.1-respect-cflags.patch b/app-text/poppler/files/poppler-0.28.1-respect-cflags.patch
deleted file mode 100644
index 0b94042c8af8..000000000000
--- a/app-text/poppler/files/poppler-0.28.1-respect-cflags.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
-index 6cadf40..7e5e6b2 100644
---- a/cmake/modules/PopplerMacros.cmake
-+++ b/cmake/modules/PopplerMacros.cmake
-@@ -98,41 +98,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
- set(CMAKE_BUILD_TYPE RelWithDebInfo)
- endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-
--if(CMAKE_COMPILER_IS_GNUCXX)
-- # set the default compile warnings
- set(DEFAULT_COMPILE_WARNINGS_NO)
- set(DEFAULT_COMPILE_WARNINGS_YES "-Wall -Wcast-align -fno-exceptions -fno-check-new -fno-common")
- set(DEFAULT_COMPILE_WARNINGS_KDE "-Wno-long-long -Wundef -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align -Wconversion -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
-
-- set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-virtual ${CMAKE_CXX_FLAGS}")
-- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
-- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
-- set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
-- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline")
-- set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
-- set(CMAKE_C_FLAGS "-std=c99")
-- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
-- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
-- set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
-- set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline")
-- set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
--
-- poppler_check_link_flag("-Wl,--as-needed" GCC_HAS_AS_NEEDED)
-- if(GCC_HAS_AS_NEEDED)
-- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
-- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
-- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
-- endif(GCC_HAS_AS_NEEDED)
--endif (CMAKE_COMPILER_IS_GNUCXX)
--
--if(CMAKE_C_COMPILER MATCHES "icc")
-- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
-- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
-- set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign")
-- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
-- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
-- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
-- set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign")
-- set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
--endif(CMAKE_C_COMPILER MATCHES "icc")
-+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual")
-
-+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14517.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14517.patch
new file mode 100644
index 000000000000..6a0812cdbe81
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14517.patch
@@ -0,0 +1,27 @@
+From b524efeffa8d192c2597f4612ca961adc30286f6 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Wed, 13 Sep 2017 22:58:14 +0200
+Subject: [PATCH 1/4] XRef::parseEntry: Fix crash in broken file
+
+Bug #102687
+---
+ poppler/XRef.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/poppler/XRef.cc b/poppler/XRef.cc
+index 6ea0fbb6..c74f2f60 100644
+--- a/poppler/XRef.cc
++++ b/poppler/XRef.cc
+@@ -1603,6 +1603,9 @@ GBool XRef::parseEntry(Goffset offset, XRefEntry *entry)
+ {
+ GBool r;
+
++ if (unlikely(entry == nullptr))
++ return gFalse;
++
+ Object obj;
+ obj.initNull();
+ Parser parser = Parser(NULL, new Lexer(NULL,
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14518.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14518.patch
new file mode 100644
index 000000000000..9e8f4bfe6246
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14518.patch
@@ -0,0 +1,27 @@
+From 6ba3bba6447897260bf4117e191e09d89d91ff62 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Wed, 13 Sep 2017 23:09:45 +0200
+Subject: [PATCH 2/4] isImageInterpolationRequired: Fix divide by 0 on broken
+ documents
+
+Bug #102688
+---
+ splash/Splash.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/splash/Splash.cc b/splash/Splash.cc
+index 46b8ce29..39fc7d64 100644
+--- a/splash/Splash.cc
++++ b/splash/Splash.cc
+@@ -4134,7 +4134,7 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, SplashICCTran
+ static GBool isImageInterpolationRequired(int srcWidth, int srcHeight,
+ int scaledWidth, int scaledHeight,
+ GBool interpolate) {
+- if (interpolate)
++ if (interpolate || srcWidth == 0 || srcHeight == 0)
+ return gTrue;
+
+ /* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14519.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14519.patch
new file mode 100644
index 000000000000..bd84e96fba3b
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14519.patch
@@ -0,0 +1,100 @@
+From 778180c0c09002f6adfc272eba6b0d0e4401c4cc Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Wed, 13 Sep 2017 23:01:03 +0200
+Subject: [PATCH 3/4] Gfx::doShowText: Fix infinite recursion on broken files
+
+Bug #102701
+---
+ poppler/Gfx.cc | 25 +++++++++++++++++++++++--
+ poppler/Gfx.h | 1 +
+ poppler/GfxFont.cc | 9 +++++++++
+ poppler/GfxFont.h | 1 +
+ 4 files changed, 34 insertions(+), 2 deletions(-)
+
+diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
+index 37220280..9feac54c 100644
+--- a/poppler/Gfx.cc
++++ b/poppler/Gfx.cc
+@@ -4031,12 +4031,33 @@ void Gfx::doShowText(GooString *s) {
+ state->transformDelta(dx, dy, &ddx, &ddy);
+ if (!out->beginType3Char(state, curX + riseX, curY + riseY, ddx, ddy,
+ code, u, uLen)) {
+- ((Gfx8BitFont *)font)->getCharProc(code, &charProc);
++ ((Gfx8BitFont *)font)->getCharProcNF(code, &charProc);
++ int refNum = -1;
++ if (charProc.isRef()) {
++ refNum = charProc.getRef().num;
++ charProc.fetch(((Gfx8BitFont *)font)->getCharProcs()->getXRef(), &charProc);
++ }
+ if ((resDict = ((Gfx8BitFont *)font)->getResources())) {
+ pushResources(resDict);
+ }
+ if (charProc.isStream()) {
+- display(&charProc, gFalse);
++ std::set<int>::iterator charProcDrawingIt;
++ bool displayCharProc = true;
++ if (refNum != -1) {
++ if (charProcDrawing.find(refNum) == charProcDrawing.end()) {
++ charProcDrawingIt = charProcDrawing.insert(refNum).first;
++ } else {
++ displayCharProc = false;
++ error(errSyntaxError, -1, "CharProc wants to draw a CharProc that is already beign drawn");
++ }
++ }
++ if (displayCharProc) {
++ display(&charProc, gFalse);
++
++ if (refNum != -1) {
++ charProcDrawing.erase(charProcDrawingIt);
++ }
++ }
+ } else {
+ error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry");
+ }
+diff --git a/poppler/Gfx.h b/poppler/Gfx.h
+index a82f9f4a..44adaed5 100644
+--- a/poppler/Gfx.h
++++ b/poppler/Gfx.h
+@@ -228,6 +228,7 @@ private:
+ Parser *parser; // parser for page content stream(s)
+
+ std::set<int> formsDrawing; // the forms that are being drawn
++ std::set<int> charProcDrawing; // the charProc that are being drawn
+
+ GBool // callback to check for an abort
+ (*abortCheckCbk)(void *data);
+diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
+index b59ec06c..bb87c5a0 100644
+--- a/poppler/GfxFont.cc
++++ b/poppler/GfxFont.cc
+@@ -1818,6 +1818,15 @@ Object *Gfx8BitFont::getCharProc(int code, Object *proc) {
+ return proc;
+ }
+
++Object *Gfx8BitFont::getCharProcNF(int code, Object *proc) {
++ if (enc[code] && charProcs.isDict()) {
++ charProcs.dictLookupNF(enc[code], proc);
++ } else {
++ proc->initNull();
++ }
++ return proc;
++}
++
+ Dict *Gfx8BitFont::getResources() {
+ return resources.isDict() ? resources.getDict() : (Dict *)NULL;
+ }
+diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
+index de7a7464..89a0ca0d 100644
+--- a/poppler/GfxFont.h
++++ b/poppler/GfxFont.h
+@@ -353,6 +353,7 @@ public:
+
+ // Return the Type 3 CharProc for the character associated with <code>.
+ Object *getCharProc(int code, Object *proc);
++ Object *getCharProcNF(int code, Object *proc);
+
+ // Return the Type 3 Resources dictionary, or NULL if none.
+ Dict *getResources();
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14520.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14520.patch
new file mode 100644
index 000000000000..f71ff53f61ac
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14520.patch
@@ -0,0 +1,24 @@
+From 504b3590182175390f474657a372e78fb1508262 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Thu, 14 Sep 2017 19:14:23 +0200
+Subject: Splash::scaleImage: Do not try to scale if srcHeight or srcWidth are
+ < 1
+
+Bug #102719
+
+diff --git a/splash/Splash.cc b/splash/Splash.cc
+index 39fc7d6..aba7814 100644
+--- a/splash/Splash.cc
++++ b/splash/Splash.cc
+@@ -4152,7 +4152,7 @@ SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData,
+ SplashBitmap *dest;
+
+ dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, gTrue, bitmap->getSeparationList());
+- if (dest->getDataPtr() != NULL) {
++ if (dest->getDataPtr() != NULL && srcHeight > 0 && srcWidth > 0) {
+ if (scaledHeight < srcHeight) {
+ if (scaledWidth < srcWidth) {
+ scaleImageYdXd(src, srcData, srcMode, nComps, srcAlpha,
+--
+cgit v0.10.2
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14617.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14617.patch
new file mode 100644
index 000000000000..279479536129
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14617.patch
@@ -0,0 +1,31 @@
+From 939465c40902d72e0c05d4f3a27ee67e4a007ed7 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Tue, 19 Sep 2017 21:19:03 +0200
+Subject: [PATCH] Fix crash in broken files
+
+Bug #102854
+---
+ poppler/Stream.cc | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/poppler/Stream.cc b/poppler/Stream.cc
+index f4eda85b..0ad602c7 100644
+--- a/poppler/Stream.cc
++++ b/poppler/Stream.cc
+@@ -454,11 +454,10 @@ ImageStream::ImageStream(Stream *strA, int widthA, int nCompsA, int nBitsA) {
+ } else {
+ imgLineSize = nVals;
+ }
+- if (width > INT_MAX / nComps) {
+- // force a call to gmallocn(-1,...), which will throw an exception
++ if (nComps <= 0 || width > INT_MAX / nComps) {
+ imgLineSize = -1;
+ }
+- imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar));
++ imgLine = (Guchar *)gmallocn_checkoverflow(imgLineSize, sizeof(Guchar));
+ }
+ imgIdx = nVals;
+ }
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14926.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14926.patch
new file mode 100644
index 000000000000..882cf0e2b8b5
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14926.patch
@@ -0,0 +1,36 @@
+From 170fe21144d469d3f865eda6e298df440b784499 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Fri, 8 Sep 2017 18:28:15 +0200
+Subject: [PATCH 2/3] Annot: Fix crash on broken files
+
+Bug #102601
+
+(cherry picked from commit 2532df6060092e9fab7f041ae9598aff9cdd94bb)
+---
+ poppler/Annot.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/poppler/Annot.cc b/poppler/Annot.cc
+index 27b698db..643ff12c 100644
+--- a/poppler/Annot.cc
++++ b/poppler/Annot.cc
+@@ -6865,13 +6865,13 @@ AnnotRichMedia::Content::Content(Dict *dict) {
+ assets = (Asset **)gmallocn(nAssets, sizeof(Asset *));
+
+ int counter = 0;
+- for (int i = 0; i < obj2.arrayGetLength(); i += 2) {
++ for (int i = 0; i < nAssets; ++i) {
+ Object objKey;
+
+ assets[counter] = new AnnotRichMedia::Asset;
+
+- obj2.arrayGet(i, &objKey);
+- obj2.arrayGet(i + 1, &assets[counter]->fileSpec);
++ obj2.arrayGet(i * 2, &objKey);
++ obj2.arrayGet(i * 2 + 1, &assets[counter]->fileSpec);
+
+ assets[counter]->name = new GooString( objKey.getString() );
+ ++counter;
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14927.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14927.patch
new file mode 100644
index 000000000000..3595345800f0
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14927.patch
@@ -0,0 +1,32 @@
+From 876e7f76159e2b12ee7d2d396f327dd2cc90bcb0 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Fri, 8 Sep 2017 18:26:05 +0200
+Subject: [PATCH 3/3] SplashOutputDev: Fix crash on broken files
+
+Bug #102604
+
+(cherry picked from commit 6472d8493f7e82cc78b41da20a2bf19fcb4e0a7d)
+---
+ poppler/SplashOutputDev.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
+index 5502be64..46b55a42 100644
+--- a/poppler/SplashOutputDev.cc
++++ b/poppler/SplashOutputDev.cc
+@@ -2714,7 +2714,11 @@ void SplashOutputDev::endType3Char(GfxState *state) {
+ }
+
+ void SplashOutputDev::type3D0(GfxState *state, double wx, double wy) {
+- t3GlyphStack->haveDx = gTrue;
++ if (likely(t3GlyphStack != nullptr)) {
++ t3GlyphStack->haveDx = gTrue;
++ } else {
++ error(errSyntaxWarning, -1, "t3GlyphStack was null in SplashOutputDev::type3D0");
++ }
+ }
+
+ void SplashOutputDev::type3D1(GfxState *state, double wx, double wy,
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14928.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14928.patch
new file mode 100644
index 000000000000..bd2af863423b
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14928.patch
@@ -0,0 +1,69 @@
+From 6bf7212c44d0131c8f8227a4a4dadc52a3afebd9 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Fri, 8 Sep 2017 18:29:42 +0200
+Subject: [PATCH 1/3] Annot: Fix crash on broken files
+
+Bug #102607
+
+(cherry picked from commit 1316c7a41f4dd7276f404f775ebb5fef2d24ab1c)
+---
+ poppler/Annot.cc | 42 +++++++++++++++++++++++-------------------
+ 1 file changed, 23 insertions(+), 19 deletions(-)
+
+diff --git a/poppler/Annot.cc b/poppler/Annot.cc
+index 974b098b..27b698db 100644
+--- a/poppler/Annot.cc
++++ b/poppler/Annot.cc
+@@ -6982,26 +6982,30 @@ AnnotRichMedia::Configuration::Configuration(Dict *dict)
+ } else if (!strcmp(name, "Video")) {
+ type = typeVideo;
+ } else {
+- // determine from first instance
++ // determine from first non null instance
++ type = typeFlash; // default in case all instances are null
+ if (instances && nInstances > 0) {
+- AnnotRichMedia::Instance *instance = instances[0];
+- switch (instance->getType()) {
+- case AnnotRichMedia::Instance::type3D:
+- type = type3D;
+- break;
+- case AnnotRichMedia::Instance::typeFlash:
+- type = typeFlash;
+- break;
+- case AnnotRichMedia::Instance::typeSound:
+- type = typeSound;
+- break;
+- case AnnotRichMedia::Instance::typeVideo:
+- type = typeVideo;
+- break;
+- default:
+- type = typeFlash;
+- break;
+- }
++ for (int i = 0; i < nInstances; ++i) {
++ AnnotRichMedia::Instance *instance = instances[i];
++ if (instance) {
++ switch (instance->getType()) {
++ case AnnotRichMedia::Instance::type3D:
++ type = type3D;
++ break;
++ case AnnotRichMedia::Instance::typeFlash:
++ type = typeFlash;
++ break;
++ case AnnotRichMedia::Instance::typeSound:
++ type = typeSound;
++ break;
++ case AnnotRichMedia::Instance::typeVideo:
++ type = typeVideo;
++ break;
++ }
++ // break the loop since we found the first non null instance
++ break;
++ }
++ }
+ }
+ }
+ }
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-14929.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14929.patch
new file mode 100644
index 000000000000..11745ca5436d
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-14929.patch
@@ -0,0 +1,252 @@
+From accdc5be215c7ee3223e3ad21dee7708d910ef23 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Mon, 25 Sep 2017 19:33:44 +0200
+Subject: [PATCH 4/4] Fix infinite recursion on broken files
+
+Bug #102969
+---
+ poppler/Gfx.cc | 46 ++++++++++++++++++++++++++++++++++------------
+ poppler/GfxState.cc | 33 ++++++++++++++++++---------------
+ poppler/GfxState.h | 15 +++++++++------
+ 3 files changed, 61 insertions(+), 33 deletions(-)
+
+diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
+index 9feac54c..66d0a24c 100644
+--- a/poppler/Gfx.cc
++++ b/poppler/Gfx.cc
+@@ -468,8 +468,14 @@ GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out, GfxState *st
+
+ for (resPtr = this; resPtr; resPtr = resPtr->next) {
+ if (resPtr->patternDict.isDict()) {
+- if (!resPtr->patternDict.dictLookup(name, &obj)->isNull()) {
+- pattern = GfxPattern::parse(resPtr, &obj, out, state);
++ if (!resPtr->patternDict.dictLookupNF(name, &obj)->isNull()) {
++ Ref patternRef = { -1, -1 };
++ if (obj.isRef()) {
++ patternRef = obj.getRef();
++ obj.fetch(resPtr->patternDict.getDict()->getXRef(), &obj);
++ }
++
++ pattern = GfxPattern::parse(resPtr, &obj, out, state, patternRef.num);
+ obj.free();
+ return pattern;
+ }
+@@ -2298,18 +2304,34 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat,
+ xi0, yi0, xi1, yi1, xstep, ystep)) {
+ goto restore;
+ } else {
+- out->updatePatternOpacity(state);
+- for (yi = yi0; yi < yi1; ++yi) {
+- for (xi = xi0; xi < xi1; ++xi) {
+- x = xi * xstep;
+- y = yi * ystep;
+- m1[4] = x * m[0] + y * m[2] + m[4];
+- m1[5] = x * m[1] + y * m[3] + m[5];
+- drawForm(tPat->getContentStream(), tPat->getResDict(),
+- m1, tPat->getBBox());
++ bool shouldDrawForm = gTrue;
++ std::set<int>::iterator patternRefIt;
++ const int patternRefNum = tPat->getPatternRefNum();
++ if (patternRefNum != -1) {
++ if (formsDrawing.find(patternRefNum) == formsDrawing.end()) {
++ patternRefIt = formsDrawing.insert(patternRefNum).first;
++ } else {
++ shouldDrawForm = gFalse;
++ }
++ }
++
++ if (shouldDrawForm) {
++ out->updatePatternOpacity(state);
++ for (yi = yi0; yi < yi1; ++yi) {
++ for (xi = xi0; xi < xi1; ++xi) {
++ x = xi * xstep;
++ y = yi * ystep;
++ m1[4] = x * m[0] + y * m[2] + m[4];
++ m1[5] = x * m[1] + y * m[3] + m[5];
++ drawForm(tPat->getContentStream(), tPat->getResDict(),
++ m1, tPat->getBBox());
++ }
++ }
++ out->clearPatternOpacity(state);
++ if (patternRefNum != -1) {
++ formsDrawing.erase(patternRefIt);
+ }
+ }
+- out->clearPatternOpacity(state);
+ }
+
+ // restore graphics state
+diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
+index f61f8124..90030b10 100644
+--- a/poppler/GfxState.cc
++++ b/poppler/GfxState.cc
+@@ -3446,14 +3446,17 @@ void GfxPatternColorSpace::getDefaultColor(GfxColor *color) {
+ // Pattern
+ //------------------------------------------------------------------------
+
+-GfxPattern::GfxPattern(int typeA) {
+- type = typeA;
++GfxPattern::GfxPattern(int typeA, int patternRefNumA)
++ : type(typeA)
++ , patternRefNum(patternRefNumA)
++{
++
+ }
+
+ GfxPattern::~GfxPattern() {
+ }
+
+-GfxPattern *GfxPattern::parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state) {
++GfxPattern *GfxPattern::parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state, int patternRefNum) {
+ GfxPattern *pattern;
+ Object obj1;
+
+@@ -3466,9 +3469,9 @@ GfxPattern *GfxPattern::parse(GfxResources *res, Object *obj, OutputDev *out, Gf
+ }
+ pattern = NULL;
+ if (obj1.isInt() && obj1.getInt() == 1) {
+- pattern = GfxTilingPattern::parse(obj);
++ pattern = GfxTilingPattern::parse(obj, patternRefNum);
+ } else if (obj1.isInt() && obj1.getInt() == 2) {
+- pattern = GfxShadingPattern::parse(res, obj, out, state);
++ pattern = GfxShadingPattern::parse(res, obj, out, state, patternRefNum);
+ }
+ obj1.free();
+ return pattern;
+@@ -3478,7 +3481,7 @@ GfxPattern *GfxPattern::parse(GfxResources *res, Object *obj, OutputDev *out, Gf
+ // GfxTilingPattern
+ //------------------------------------------------------------------------
+
+-GfxTilingPattern *GfxTilingPattern::parse(Object *patObj) {
++GfxTilingPattern *GfxTilingPattern::parse(Object *patObj, int patternRefNum) {
+ GfxTilingPattern *pat;
+ Dict *dict;
+ int paintTypeA, tilingTypeA;
+@@ -3555,7 +3558,7 @@ GfxTilingPattern *GfxTilingPattern::parse(Object *patObj) {
+ obj1.free();
+
+ pat = new GfxTilingPattern(paintTypeA, tilingTypeA, bboxA, xStepA, yStepA,
+- &resDictA, matrixA, patObj);
++ &resDictA, matrixA, patObj, patternRefNum);
+ resDictA.free();
+ return pat;
+ }
+@@ -3563,8 +3566,8 @@ GfxTilingPattern *GfxTilingPattern::parse(Object *patObj) {
+ GfxTilingPattern::GfxTilingPattern(int paintTypeA, int tilingTypeA,
+ double *bboxA, double xStepA, double yStepA,
+ Object *resDictA, double *matrixA,
+- Object *contentStreamA):
+- GfxPattern(1)
++ Object *contentStreamA, int patternRefNumA) :
++ GfxPattern(1, patternRefNumA)
+ {
+ int i;
+
+@@ -3589,14 +3592,14 @@ GfxTilingPattern::~GfxTilingPattern() {
+
+ GfxPattern *GfxTilingPattern::copy() {
+ return new GfxTilingPattern(paintType, tilingType, bbox, xStep, yStep,
+- &resDict, matrix, &contentStream);
++ &resDict, matrix, &contentStream, getPatternRefNum());
+ }
+
+ //------------------------------------------------------------------------
+ // GfxShadingPattern
+ //------------------------------------------------------------------------
+
+-GfxShadingPattern *GfxShadingPattern::parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state) {
++GfxShadingPattern *GfxShadingPattern::parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state, int patternRefNum) {
+ Dict *dict;
+ GfxShading *shadingA;
+ double matrixA[6];
+@@ -3629,11 +3632,11 @@ GfxShadingPattern *GfxShadingPattern::parse(GfxResources *res, Object *patObj, O
+ }
+ obj1.free();
+
+- return new GfxShadingPattern(shadingA, matrixA);
++ return new GfxShadingPattern(shadingA, matrixA, patternRefNum);
+ }
+
+-GfxShadingPattern::GfxShadingPattern(GfxShading *shadingA, double *matrixA):
+- GfxPattern(2)
++GfxShadingPattern::GfxShadingPattern(GfxShading *shadingA, double *matrixA, int patternRefNumA):
++ GfxPattern(2, patternRefNumA)
+ {
+ int i;
+
+@@ -3648,7 +3651,7 @@ GfxShadingPattern::~GfxShadingPattern() {
+ }
+
+ GfxPattern *GfxShadingPattern::copy() {
+- return new GfxShadingPattern(shading->copy(), matrix);
++ return new GfxShadingPattern(shading->copy(), matrix, getPatternRefNum());
+ }
+
+ //------------------------------------------------------------------------
+diff --git a/poppler/GfxState.h b/poppler/GfxState.h
+index 7bcedf2a..4b13fb2a 100644
+--- a/poppler/GfxState.h
++++ b/poppler/GfxState.h
+@@ -762,18 +762,21 @@ private:
+ class GfxPattern {
+ public:
+
+- GfxPattern(int typeA);
++ GfxPattern(int typeA, int patternRefNumA);
+ virtual ~GfxPattern();
+
+- static GfxPattern *parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state);
++ static GfxPattern *parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state, int patternRefNum);
+
+ virtual GfxPattern *copy() = 0;
+
+ int getType() { return type; }
+
++ int getPatternRefNum() const { return patternRefNum; }
++
+ private:
+
+ int type;
++ int patternRefNum;
+ };
+
+ //------------------------------------------------------------------------
+@@ -783,7 +786,7 @@ private:
+ class GfxTilingPattern: public GfxPattern {
+ public:
+
+- static GfxTilingPattern *parse(Object *patObj);
++ static GfxTilingPattern *parse(Object *patObj, int patternRefNum);
+ ~GfxTilingPattern();
+
+ GfxPattern *copy() override;
+@@ -803,7 +806,7 @@ private:
+ GfxTilingPattern(int paintTypeA, int tilingTypeA,
+ double *bboxA, double xStepA, double yStepA,
+ Object *resDictA, double *matrixA,
+- Object *contentStreamA);
++ Object *contentStreamA, int patternRefNumA);
+
+ int paintType;
+ int tilingType;
+@@ -821,7 +824,7 @@ private:
+ class GfxShadingPattern: public GfxPattern {
+ public:
+
+- static GfxShadingPattern *parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state);
++ static GfxShadingPattern *parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state, int patternRefNum);
+ ~GfxShadingPattern();
+
+ GfxPattern *copy() override;
+@@ -831,7 +834,7 @@ public:
+
+ private:
+
+- GfxShadingPattern(GfxShading *shadingA, double *matrixA);
++ GfxShadingPattern(GfxShading *shadingA, double *matrixA, int patternRefNumA);
+
+ GfxShading *shading;
+ double matrix[6];
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-CVE-2017-15565.patch b/app-text/poppler/files/poppler-0.57.0-CVE-2017-15565.patch
new file mode 100644
index 000000000000..7e4db3f04452
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-CVE-2017-15565.patch
@@ -0,0 +1,28 @@
+From 19ebd40547186a8ea6da08c8d8e2a6d6b7e84f5d Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Fri, 13 Oct 2017 00:55:49 +0200
+Subject: [PATCH] CairoOutputDev: Fix crash in broken files
+
+Bug #103016
+---
+ poppler/CairoOutputDev.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
+index ffd39ef7..80f7a99e 100644
+--- a/poppler/CairoOutputDev.cc
++++ b/poppler/CairoOutputDev.cc
+@@ -2714,7 +2714,9 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s
+ for (y = 0; y < maskHeight; y++) {
+ maskDest = (unsigned char *) (maskBuffer + y * row_stride);
+ pix = maskImgStr->getLine();
+- maskColorMap->getGrayLine (pix, maskDest, maskWidth);
++ if (likely(pix != nullptr)) {
++ maskColorMap->getGrayLine (pix, maskDest, maskWidth);
++ }
+ }
+
+ maskImgStr->close();
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.57.0-disable-internal-jpx.patch b/app-text/poppler/files/poppler-0.57.0-disable-internal-jpx.patch
new file mode 100644
index 000000000000..faf632128ff7
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.57.0-disable-internal-jpx.patch
@@ -0,0 +1,25 @@
+Fix security issue [internal unmaintained JPX decoder] that is caused
+by building without system-jpeg libs. Fedora does not care because they
+always build with system-jpeg, however in Gentoo we allow the user to
+disable both options and poppler's buildsystem is making us believe
+there would be no JPX decoder built in that case, when in reality
+JPXStream.cc is built (even if it may not be used by the code).
+
+
+--- a/CMakeLists.txt 2017-11-24 23:12:41.953450442 +0100
++++ b/CMakeLists.txt 2017-11-24 23:16:09.441030669 +0100
+@@ -506,9 +508,11 @@
+ add_definitions(-DUSE_OPENJPEG2)
+ set(poppler_LIBS ${poppler_LIBS} ${LIBOPENJPEG2_LIBRARIES})
+ else ()
+- set(poppler_SRCS ${poppler_SRCS}
+- poppler/JPXStream.cc
+- )
++ if(NOT WITH_OPENJPEG AND HAVE_JPX_DECODER)
++ set(poppler_SRCS ${poppler_SRCS}
++ poppler/JPXStream.cc
++ )
++ endif()
+ endif()
+ if(USE_CMS)
+ if(LCMS_FOUND)