Update to 0.84.0

Resolves: #1673727
This commit is contained in:
Marek Kasik 2020-01-17 12:32:20 +01:00
parent bb6405253b
commit 37b06ec549
20 changed files with 181 additions and 723 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/poppler-0.67.0.tar.xz
/poppler-0.73.0.tar.xz
/poppler-test-2018-12-18-45f55f1e03b9bf3fbd334c31776b6f5e472889ec.tar.xz
/poppler-0.84.0.tar.xz

View File

@ -228,10 +228,10 @@ index 5e3d6a17..431059fb 100644
@@ -40,6 +40,7 @@ set (CMAKE_CXX_EXTENSIONS OFF)
# command line switches
option(ENABLE_UNSTABLE_API_ABI_HEADERS "Install API/ABI unstable xpdf headers." OFF)
option(BUILD_GTK_TESTS "Whether compile the GTK+ test programs." ON)
+option(BUILD_QT4_TESTS "Whether compile the Qt4 test programs." ON)
option(BUILD_QT5_TESTS "Whether compile the Qt5 test programs." ON)
option(BUILD_CPP_TESTS "Whether compile the CPP test programs." ON)
option(BUILD_GTK_TESTS "Whether to compile the GTK+ test programs." ON)
+option(BUILD_QT4_TESTS "Whether to compile the Qt4 test programs." ON)
option(BUILD_QT5_TESTS "Whether to compile the Qt5 test programs." ON)
option(BUILD_CPP_TESTS "Whether to compile the CPP test programs." ON)
option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
@@ -47,6 +48,7 @@ option(ENABLE_UTILS "Compile poppler command line utils." ON)
option(ENABLE_GLIB "Compile poppler glib wrapper." ON)
@ -274,18 +274,18 @@ index 5e3d6a17..431059fb 100644
add_subdirectory(qt5)
endif()
@@ -685,6 +698,9 @@ poppler_create_install_pkgconfig(poppler.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if(ENABLE_SPLASH)
poppler_create_install_pkgconfig(poppler-splash.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
+if(ENABLE_QT4)
+ poppler_create_install_pkgconfig(poppler-qt4.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+endif()
if(ENABLE_QT5)
poppler_create_install_pkgconfig(poppler-qt5.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
if(ENABLE_SPLASH)
poppler_create_install_pkgconfig(poppler-splash.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
+ if(ENABLE_QT4)
+ poppler_create_install_pkgconfig(poppler-qt4.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+ endif()
if(ENABLE_QT5)
poppler_create_install_pkgconfig(poppler-qt5.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
@@ -706,6 +722,7 @@ if(SPLASH_CMYK)
message(" with CMYK support")
endif()
show_end_message("font configuration" ${font_configuration})
show_end_message_yesno("splash output" ENABLE_SPLASH)
show_end_message_yesno("cairo output" CAIRO_FOUND)
+show_end_message_yesno("qt4 wrapper" ENABLE_QT4)
show_end_message_yesno("qt5 wrapper" ENABLE_QT5)
@ -3920,7 +3920,7 @@ index 00000000..f2fa6f17
+ const bool isSlightHinting = m_fontHinting == SlightHinting;
+
+ m_fontEngine = new SplashFontEngine(
+ globalParams->getEnableFreeType(),
+ true, // I just set this to true. We should finally remove the QT4.
+ isHintingEnabled,
+ isSlightHinting,
+ m_painter->testRenderHint(QPainter::TextAntialiasing));
@ -4303,9 +4303,9 @@ index 00000000..f2fa6f17
+#endif
+}
+
+static QPainterPath convertPath(GfxState *state, GfxPath *path, Qt::FillRule fillRule)
+static QPainterPath convertPath(GfxState *state, const GfxPath *path, Qt::FillRule fillRule)
+{
+ GfxSubpath *subpath;
+ const GfxSubpath *subpath;
+ double x1, y1, x2, y2, x3, y3;
+ int i, j;
+
@ -6735,7 +6735,7 @@ index 00000000..3150569c
+
+void XPDFReader::lookupIntRef( Dict * dict, char * type, int & dest )
+{
+ Object refObj = dict->lookupNF( type );
+ Object refObj = dict->lookupNF( type ).copy();
+ if ( refObj.isNull() )
+ return;
+ if ( refObj.isRef() )
@ -13841,7 +13841,7 @@ index 00000000..d6e2fbf7
+ {
+ XRef *xref = m_doc->doc->getXRef()->copy();
+
+ Object refObj(fi.m_data->embRef.num, fi.m_data->embRef.gen);
+ Object refObj(fi.m_data->embRef);
+ Object strObj = refObj.fetch(xref);
+ if (strObj.isStream())
+ {
@ -14186,12 +14186,12 @@ index 00000000..d6e2fbf7
+ if ( !outline )
+ return NULL;
+
+ GooList * items = outline->getItems();
+ if ( !items || items->getLength() < 1 )
+ const std::vector<::OutlineItem*> * items = outline->getItems();
+ if ( !items || items->size() < 1 )
+ return NULL;
+
+ QDomDocument *toc = new QDomDocument();
+ if ( items->getLength() > 0 )
+ if ( items->size() > 0 )
+ m_doc->addTocChildren( toc, toc, items );
+
+ return toc;
@ -14778,14 +14778,14 @@ index 00000000..5bb9e3a8
+ ++d->currentPage;
+
+ QList<FontInfo> fonts;
+ GooList *items = d->fontInfoScanner.scan( 1 );
+ if ( !items )
+ return fonts;
+ fonts.reserve( items->getLength() );
+ for ( int i = 0; i < items->getLength(); ++i ) {
+ fonts.append( FontInfo( FontInfoData( ( ::FontInfo* )items->get( i ) ) ) );
+ const std::vector<::FontInfo*> items = d->fontInfoScanner.scan( 1 );
+ fonts.reserve( items.size() );
+ for ( ::FontInfo* entry : items ) {
+ fonts.append( FontInfo( FontInfoData( entry ) ) );
+ delete entry;
+ }
+ deleteGooList<::FontInfo>( items );
+
+
+ return fonts;
+}
+
@ -16050,7 +16050,7 @@ index 00000000..1e37f5bd
+ else
+ {
+ Ref ref = ld->getPageRef();
+ d->pageNum = data.doc->doc->findPage( ref.num, ref.gen );
+ d->pageNum = data.doc->doc->findPage( ref );
+ }
+ double left = ld->getLeft();
+ double bottom = ld->getBottom();
@ -17720,7 +17720,7 @@ index 00000000..0e7b5345
+ {
+ itemsInGroup.reserve( rbarray->getLength() );
+ for (int i = 0; i < rbarray->getLength(); ++i) {
+ Object ref = rbarray->getNF( i );
+ const Object &ref = rbarray->getNF( i );
+ if ( ! ref.isRef() ) {
+ qDebug() << "expected ref, but got:" << ref.getType();
+ }
@ -17878,7 +17878,7 @@ index 00000000..0e7b5345
+ for (int i = 0; i < orderArray->getLength(); ++i) {
+ Object orderItem = orderArray->get(i);
+ if ( orderItem.isDict() ) {
+ Object item = orderArray->getNF(i);
+ const Object &item = orderArray->getNF(i);
+ if (item.isRef() ) {
+ OptContentItem *ocItem = m_optContentItems.value(QString::number(item.getRefNum()), 0);
+ if (ocItem) {
@ -18074,18 +18074,18 @@ index 00000000..0e7b5345
+
+ QSet<OptContentItem *> changedItems;
+
+ const GooList *statesList = popplerLinkOCGState->getStateList();
+ for (int i = 0; i < statesList->getLength(); ++i) {
+ ::LinkOCGState::StateList *stateList = (::LinkOCGState::StateList*)statesList->get(i);
+ const std::vector<::LinkOCGState::StateList>& statesList = popplerLinkOCGState->getStateList();
+ for (const ::LinkOCGState::StateList& stateList : statesList) {
+ const std::vector<Ref>& refsList = stateList.list;
+ for (const Ref& ref : refsList) {
+ OptContentItem *item = d->itemFromRef(QString::number(ref.num));
+
+ GooList *refsList = stateList->list;
+ for (int j = 0; j < refsList->getLength(); ++j) {
+ Ref *ref = (Ref *)refsList->get(j);
+ OptContentItem *item = d->itemFromRef(QString::number(ref->num));
+
+ if (stateList->st == ::LinkOCGState::On) {
+
+
+ if (stateList.st == ::LinkOCGState::On) {
+ item->setState(OptContentItem::On, popplerLinkOCGState->getPreserveRB(), changedItems);
+ } else if (stateList->st == ::LinkOCGState::Off) {
+ } else if (stateList.st == ::LinkOCGState::Off) {
+ item->setState(OptContentItem::Off, popplerLinkOCGState->getPreserveRB(), changedItems);
+ } else {
+ OptContentItem::ItemState newState = item->state() == OptContentItem::On ? OptContentItem::Off : OptContentItem::On;
@ -19209,7 +19209,7 @@ index 00000000..ffe6e99c
+ return output_list;
+ }
+
+ QHash<TextWord *, TextBox*> wordBoxMap;
+ QHash<const TextWord *, TextBox*> wordBoxMap;
+
+ output_list.reserve(word_list->getLength());
+ for (int i = 0; i < word_list->getLength(); i++) {
@ -19772,8 +19772,8 @@ index 00000000..1338a185
+ count --;
+ if ( count == 0 )
+ {
+ utf8Map = 0;
+ delete globalParams;
+ utf8Map = nullptr;
+ globalParams.reset();
+ }
+ }
+
@ -19787,21 +19787,21 @@ index 00000000..1338a185
+
+ if ( count == 0 )
+ {
+ utf8Map = 0;
+ globalParams = new GlobalParams();
+ utf8Map = nullptr;
+ globalParams = std::make_unique<GlobalParams>();
+ setErrorCallback(qt4ErrorFunction, nullptr);
+ }
+ count ++;
+ }
+
+
+ void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, const GooList * items )
+ void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, const std::vector<::OutlineItem*> * items )
+ {
+ int numItems = items->getLength();
+ for ( int i = 0; i < numItems; ++i )
+
+ for ( ::OutlineItem * outlineItem : *items )
+ {
+ // iterate over every object in 'items'
+ OutlineItem * outlineItem = (OutlineItem *)items->get( i );
+
+
+ // 1. create element using outlineItem's title as tagName
+ QString name;
@ -19822,7 +19822,7 @@ index 00000000..1338a185
+
+ // 3. recursively descend over children
+ outlineItem->open();
+ const GooList * children = outlineItem->getKids();
+ const std::vector<::OutlineItem*> * children = outlineItem->getKids();
+ if ( children )
+ addTocChildren( docSyn, &item, children );
+ }
@ -19834,7 +19834,7 @@ new file mode 100644
index 00000000..a5ad3f3e
--- /dev/null
+++ b/qt4/src/poppler-private.h
@@ -0,0 +1,241 @@
@@ -0,0 +1,242 @@
+/* poppler-private.h: qt interface to poppler
+ * Copyright (C) 2005, Net Integration Technologies, Inc.
+ * Copyright (C) 2005, 2008, Brad Hards <bradh@frogmouth.net>
@ -19878,6 +19878,7 @@ index 00000000..a5ad3f3e
+#include <FontInfo.h>
+#include <OutputDev.h>
+#include <Error.h>
+#include <Outline.h>
+#if defined(HAVE_SPLASH)
+#include <SplashOutputDev.h>
+#endif
@ -19952,7 +19953,7 @@ index 00000000..a5ad3f3e
+
+ ~DocumentData();
+
+ void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items );
+ void addTocChildren( QDomDocument * docSyn, QDomNode * parent, const std::vector<OutlineItem*> * items );
+
+ void setPaperColor(const QColor &color)
+ {
@ -24158,7 +24159,7 @@ index 00000000..2de29952
+void TestOptionalContent::checkIsVisible()
+{
+ GooString *fileName = new GooString(TESTDATADIR "/unittestcases/vis_policy_test.pdf");
+ globalParams = new GlobalParams();
+ globalParams = std::make_unique<GlobalParams>();
+ PDFDoc *doc = new PDFDoc( fileName );
+ QVERIFY( doc );
+
@ -24173,65 +24174,65 @@ index 00000000..2de29952
+
+ // AnyOn, one element array:
+ // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 22, 0 );
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QVERIFY( ocgs->optContentIsVisible( &obj ) );
+
+ // Same again, looking for any leaks or dubious free()'s
+ obj = xref->fetch( 22, 0 );
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QVERIFY( ocgs->optContentIsVisible( &obj ) );
+
+ // AnyOff, one element array:
+ // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj
+ obj = xref->fetch( 29, 0 );
+ obj = xref->fetch( { 29, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOn, one element array:
+ // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj
+ obj = xref->fetch( 36, 0 );
+ obj = xref->fetch( { 36, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+
+ // AllOff, one element array:
+ // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj
+ obj = xref->fetch( 43, 0 );
+ obj = xref->fetch( { 43, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AnyOn, multi-element array:
+ // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 50, 0 );
+ obj = xref->fetch( { 50, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AnyOff, multi-element array:
+ // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 57, 0 );
+ obj = xref->fetch( { 57, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOn, multi-element array:
+ // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 64, 0 );
+ obj = xref->fetch( { 64, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AllOff, multi-element array:
+ // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 71, 0 );
+ obj = xref->fetch( { 71, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ delete doc;
+ delete globalParams;
+ globalParams.reset();
+}
+
+void TestOptionalContent::checkVisibilitySetting()
+{
+ globalParams = new GlobalParams();
+ globalParams = std::make_unique<GlobalParams>();
+ GooString *fileName = new GooString(TESTDATADIR "/unittestcases/vis_policy_test.pdf");
+ PDFDoc *doc = new PDFDoc( fileName );
+ QVERIFY( doc );
@ -24245,7 +24246,7 @@ index 00000000..2de29952
+
+ // In this test, both Ref(21,0) and Ref(28,0) start On,
+ // based on the file settings
+ Object ref21obj( 21, 0 );
+ Object ref21obj( { 21, 0 } );
+ Ref ref21 = ref21obj.getRef();
+ OptionalContentGroup *ocgA = ocgs->findOcgByRef( ref21 );
+ QVERIFY( ocgA );
@ -24253,7 +24254,7 @@ index 00000000..2de29952
+ QVERIFY( (ocgA->getName()->cmp("A")) == 0 );
+ QCOMPARE( ocgA->getState(), OptionalContentGroup::On );
+
+ Object ref28obj( 28, 0 );
+ Object ref28obj( { 28, 0 } );
+ Ref ref28 = ref28obj.getRef();
+ OptionalContentGroup *ocgB = ocgs->findOcgByRef( ref28 );
+ QVERIFY( ocgB );
@ -24266,54 +24267,54 @@ index 00000000..2de29952
+
+ // AnyOn, one element array:
+ // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 22, 0 );
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // Same again, looking for any leaks or dubious free()'s
+ obj = xref->fetch( 22, 0 );
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AnyOff, one element array:
+ // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj
+ obj = xref->fetch( 29, 0 );
+ obj = xref->fetch( { 29, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AllOn, one element array:
+ // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj
+ obj = xref->fetch( 36, 0 );
+ obj = xref->fetch( { 36, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AllOff, one element array:
+ // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj
+ obj = xref->fetch( 43, 0 );
+ obj = xref->fetch( { 43, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AnyOn, multi-element array:
+ // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 50, 0 );
+ obj = xref->fetch( { 50, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AnyOff, multi-element array:
+ // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 57, 0 );
+ obj = xref->fetch( { 57, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AllOn, multi-element array:
+ // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 64, 0 );
+ obj = xref->fetch( { 64, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOff, multi-element array:
+ // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 71, 0 );
+ obj = xref->fetch( { 71, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
@ -24323,54 +24324,54 @@ index 00000000..2de29952
+
+ // AnyOn, one element array:
+ // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 22, 0 );
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // Same again, looking for any leaks or dubious free()'s
+ obj = xref->fetch( 22, 0 );
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AnyOff, one element array:
+ // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj
+ obj = xref->fetch( 29, 0 );
+ obj = xref->fetch( { 29, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AllOn, one element array:
+ // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj
+ obj = xref->fetch( 36, 0 );
+ obj = xref->fetch( { 36, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOff, one element array:
+ // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj
+ obj = xref->fetch( 43, 0 );
+ obj = xref->fetch( { 43, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AnyOn, multi-element array:
+ // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 50, 0 );
+ obj = xref->fetch( { 50, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AnyOff, multi-element array:
+ // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 57, 0 );
+ obj = xref->fetch( { 57, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AllOn, multi-element array:
+ // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 64, 0 );
+ obj = xref->fetch( { 64, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOff, multi-element array:
+ // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 71, 0 );
+ obj = xref->fetch( { 71, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
@ -24380,59 +24381,59 @@ index 00000000..2de29952
+
+ // AnyOn, one element array:
+ // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 22, 0);
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // Same again, looking for any leaks or dubious free()'s
+ obj = xref->fetch( 22, 0);
+ obj = xref->fetch( { 22, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AnyOff, one element array:
+ // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj
+ obj = xref->fetch( 29, 0);
+ obj = xref->fetch( { 29, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOn, one element array:
+ // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj
+ obj = xref->fetch( 36, 0);
+ obj = xref->fetch( { 36, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOff, one element array:
+ // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj
+ obj = xref->fetch( 43, 0);
+ obj = xref->fetch( { 43, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AnyOn, multi-element array:
+ // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj
+ obj = xref->fetch( 50, 0);
+ obj = xref->fetch( { 50, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AnyOff, multi-element array:
+ // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 57, 0);
+ obj = xref->fetch( { 57, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), true );
+
+ // AllOn, multi-element array:
+ // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 64, 0);
+ obj = xref->fetch( { 64, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ // AllOff, multi-element array:
+ // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj
+ obj = xref->fetch( 71, 0 );
+ obj = xref->fetch( { 71, 0 } );
+ QVERIFY( obj.isDict() );
+ QCOMPARE( ocgs->optContentIsVisible( &obj ), false );
+
+ delete doc;
+ delete globalParams;
+ globalParams.reset();
+}
+
+void TestOptionalContent::checkRadioButtons()
@ -25086,14 +25087,14 @@ index 00000000..700ae9c2
+ qRegisterMetaType<GooString*>("GooString*");
+ qRegisterMetaType<Unicode*>("Unicode*");
+
+ globalParams = new GlobalParams();
+ globalParams = std::make_unique<GlobalParams>();
+}
+
+void TestStrings::cleanupTestCase()
+{
+ qDeleteAll(m_gooStrings);
+
+ delete globalParams;
+ globalParams.reset();
+}
+
+void TestStrings::check_unicodeToQString_data()

View File

@ -17,8 +17,8 @@ index 7c2ca78..e93908c 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -178,6 +178,12 @@
#define combMaxMidDelta 0.3
#define combMaxBaseDelta 0.4
// (Or 1/tan(angle) for 90/270 degrees.)
#define diagonalThreshold 0.1
+// Returns whether x is between a and b or equal to a or b.
+// a and b don't need to be sorted.

View File

@ -1,8 +0,0 @@
--- poppler-0.63.0/make-glib-api-docs
+++ poppler-0.63.0/make-glib-api-docs
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# Copyright (C) 2017 Carlos Garcia Campos <carlosgc@gnome.org>
#

View File

@ -1,14 +1,5 @@
--- poppler-0.67.0/qt4/src/poppler-document.cc.orig 2018-08-08 10:13:17.130028069 +0200
+++ poppler-0.67.0/qt4/src/poppler-document.cc 2018-08-08 11:14:58.301690615 +0200
@@ -605,7 +605,7 @@ namespace Poppler {
if ( !outline )
return NULL;
- GooList * items = outline->getItems();
+ const GooList * items = outline->getItems();
if ( !items || items->getLength() < 1 )
return NULL;
@@ -799,7 +799,7 @@ namespace Poppler {
return Document::NoForm; // make gcc happy
}
@ -130,15 +121,6 @@
Poppler::DocumentData *doc;
bool externalDest;
};
@@ -115,7 +115,7 @@ namespace Poppler {
~DocumentData();
- void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items );
+ void addTocChildren( QDomDocument * docSyn, QDomNode * parent, const GooList * items );
void setPaperColor(const QColor &color)
{
--- poppler-0.67.0/qt4/src/poppler-qt4.h.orig 2018-08-08 10:13:17.133028093 +0200
+++ poppler-0.67.0/qt4/src/poppler-qt4.h 2018-08-08 10:29:23.807858790 +0200
@@ -1816,7 +1816,12 @@ height = dummy.height();

View File

@ -1,26 +0,0 @@
From 68ef84e5968a4249c2162b839ca6d7975048a557 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Mon, 15 Jul 2019 23:24:22 +0200
Subject: [PATCH] JPXStream::init: ignore dict Length if clearly broken
Fixes issue #805
---
poppler/JPEG2000Stream.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
index 0eea3a2d..8e6902f4 100644
--- a/poppler/JPEG2000Stream.cc
+++ b/poppler/JPEG2000Stream.cc
@@ -219,7 +219,7 @@ void JPXStream::init()
}
int bufSize = BUFFER_INITIAL_SIZE;
- if (oLen.isInt()) bufSize = oLen.getInt();
+ if (oLen.isInt() && oLen.getInt() > 0) bufSize = oLen.getInt();
bool indexed = false;
if (cspace.isArray() && cspace.arrayGetLength() > 0) {
--
2.21.0

View File

@ -1,46 +0,0 @@
From 7b4e372deeb716eb3fe3a54b31ed41af759224f9 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Mon, 4 Mar 2019 12:55:12 +0100
Subject: [PATCH] pdfunite: Check XRef's Catalog for being a Dict
Check whether Catalog from XRef is Dict for each document
passed to pdfunite and return error if not.
https://gitlab.freedesktop.org/poppler/poppler/issues/706
---
utils/pdfunite.cc | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc
index b0142116..23888684 100644
--- a/utils/pdfunite.cc
+++ b/utils/pdfunite.cc
@@ -165,7 +165,8 @@ int main (int argc, char *argv[])
for (i = 1; i < argc - 1; i++) {
GooString *gfileName = new GooString(argv[i]);
PDFDoc *doc = new PDFDoc(gfileName, nullptr, nullptr, nullptr);
- if (doc->isOk() && !doc->isEncrypted()) {
+ if (doc->isOk() && !doc->isEncrypted() &&
+ doc->getXRef()->getCatalog().isDict()) {
docs.push_back(doc);
if (doc->getPDFMajorVersion() > majorVersion) {
majorVersion = doc->getPDFMajorVersion();
@@ -176,8 +177,13 @@ int main (int argc, char *argv[])
}
}
} else if (doc->isOk()) {
- error(errUnimplemented, -1, "Could not merge encrypted files ('{0:s}')", argv[i]);
- return -1;
+ if (doc->isEncrypted()) {
+ error(errUnimplemented, -1, "Could not merge encrypted files ('{0:s}')", argv[i]);
+ return -1;
+ } else if (!doc->getXRef()->getCatalog().isDict()) {
+ error(errSyntaxError, -1, "XRef's Catalog is not a dictionary ('{0:s}')", argv[i]);
+ return -1;
+ }
} else {
error(errSyntaxError, -1, "Could not merge damaged documents ('{0:s}')", argv[i]);
return -1;
--
2.20.1

View File

@ -1,34 +0,0 @@
From e0b8a980b71c29afdedaf37148c507947e83ce44 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 20 Sep 2019 16:33:04 +0200
Subject: [PATCH] CairoOutputDev: Check scaled dimensions for 0
Check scaledWidth and scaledHeight for 0 at RescaleDrawImage::getSourceImage()
as is done on other places. Set the dimension to 1 if it is 0.
Fixes issue #737
---
poppler/CairoOutputDev.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 68927636..12f312c6 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -3134,6 +3134,13 @@ public:
scaledWidth = MAX_PRINT_IMAGE_SIZE * (double)width/height;
}
needsCustomDownscaling = true;
+
+ if (scaledWidth == 0) {
+ scaledWidth = 1;
+ }
+ if (scaledHeight == 0) {
+ scaledHeight = 1;
+ }
} else {
needsCustomDownscaling = false;
}
--
2.21.0

View File

@ -1,25 +0,0 @@
From 8dbe2e6c480405dab9347075cf4be626f90f1d05 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Wed, 3 Apr 2019 18:02:42 +0200
Subject: SplashXPathScanner::clipAALine: Fix crash on broken file
Make sure the index of allIntersections we access is valid
Fixes #748
diff --git a/splash/SplashXPathScanner.cc b/splash/SplashXPathScanner.cc
index 8362a6a5..23b4f7c4 100644
--- a/splash/SplashXPathScanner.cc
+++ b/splash/SplashXPathScanner.cc
@@ -452,7 +452,10 @@ void SplashXPathScanner::clipAALine(SplashBitmap *aaBuf,
for (yy = 0; yy < splashAASize; ++yy) {
xx = *x0 * splashAASize;
if (yy >= yyMin && yy <= yyMax) {
- const auto& line = allIntersections[splashAASize * y + yy - yMin];
+ const int intersectionIndex = splashAASize * y + yy - yMin;
+ if (unlikely(intersectionIndex < 0 || (unsigned)intersectionIndex >= allIntersections.size()))
+ break;
+ const auto& line = allIntersections[intersectionIndex];
interIdx = 0;
interCount = 0;
while (interIdx < line.size() && xx < (*x1 + 1) * splashAASize) {

View File

@ -1,35 +0,0 @@
From d716e636231c8d636bf2139896d817b66fe6d510 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 21 Mar 2019 13:15:37 +0100
Subject: [PATCH 1/2] cairo: Compute correct coverage values for box filter
Use double precision for computation of coverage
of the left most pixel in the box filter.
Issue #736
---
poppler/CairoRescaleBox.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index b8371a5b..d7615010 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -226,10 +227,10 @@ static int compute_coverage (int coverage[], int src_length, int dest_length)
/* I have a proof of this, which this margin is too narrow to contain */
for (i=0; i<dest_length; i++)
{
- float left_side = i*scale;
- float right_side = (i+1)*scale;
- float right_fract = right_side - floor (right_side);
- float left_fract = ceil (left_side) - left_side;
+ double left_side = i*scale;
+ double right_side = (i+1)*scale;
+ double right_fract = right_side - floor (right_side);
+ double left_fract = ceil (left_side) - left_side;
int overage;
/* find out how many source pixels will be used to fill the box */
int count = floor (right_side) - ceil (left_side);
--
2.20.1

View File

@ -1,27 +0,0 @@
From f4136a6353162db249f63ddb0f20611622ab61b4 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Wed, 27 Feb 2019 19:43:22 +0100
Subject: [PATCH] ImageStream::getLine: fix crash on broken files
Fixes #728
---
poppler/Stream.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 33537b0e..a41435ab 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -496,6 +496,9 @@ unsigned char *ImageStream::getLine() {
}
int readChars = str->doGetChars(inputLineSize, inputLine);
+ if (unlikely(readChars == -1)) {
+ readChars = 0;
+ }
for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
if (nBits == 1) {
unsigned char *p = inputLine;
--
2.20.1

View File

@ -1,41 +0,0 @@
From 89a5367d49b2556a2635dbb6d48d6a6b182a2c6c Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Thu, 23 May 2019 00:54:29 +0200
Subject: [PATCH] JPEG2000Stream: fail gracefully if not all components have
the same WxH
I think this is just a mistake, or at least the only file we have with
this scenario is a fuzzed one
---
poppler/JPEG2000Stream.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
index 15bbcae4..0eea3a2d 100644
--- a/poppler/JPEG2000Stream.cc
+++ b/poppler/JPEG2000Stream.cc
@@ -4,7 +4,7 @@
//
// A JPX stream decoder using OpenJPEG
//
-// Copyright 2008-2010, 2012, 2017, 2018 Albert Astals Cid <aacid@kde.org>
+// Copyright 2008-2010, 2012, 2017-2019 Albert Astals Cid <aacid@kde.org>
// Copyright 2011 Daniel Glöckner <daniel-gl@gmx.net>
// Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright 2013, 2014 Adrian Johnson <ajohnson@redneon.com>
@@ -253,6 +253,12 @@ void JPXStream::init()
close();
break;
}
+ const int componentPixels = priv->image->comps[component].w * priv->image->comps[component].h;
+ if (componentPixels != priv->npixels) {
+ error(errSyntaxWarning, -1, "Component {0:d} has different WxH than component 0", component);
+ close();
+ break;
+ }
unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
int adjust = 0;
int depth = priv->image->comps[component].prec;
--
2.21.0

View File

@ -1,29 +0,0 @@
From b54e1fc3e0d2600621a28d50f9f085b9e38619c2 Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Fri, 1 Feb 2019 08:42:27 +0100
Subject: [PATCH] Also defend against requests for negative XRef indices.
oss-fuzz/12797
---
poppler/XRef.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index d042d1f4..ac2cd0ce 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1565,6 +1565,11 @@ DummyXRefEntry dummyXRefEntry;
XRefEntry *XRef::getEntry(int i, bool complainIfMissing)
{
+ if (unlikely(i < 0)) {
+ error(errInternal, -1, "Request for invalid XRef entry [{0:d}]", i);
+ return &dummyXRefEntry;
+ }
+
if (i >= size || entries[i].type == xrefEntryNone) {
if ((!xRefStream) && mainXRefEntriesOffset) {
--
2.20.1

View File

@ -1,135 +0,0 @@
From 6a1580e84f492b5671d23be98192267bb73de250 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Mon, 13 May 2019 15:08:38 +0200
Subject: Splash: Restrict filling of overlapping boxes
Check whether area to fill in Splash::blitTransparent()
does not run out of allocated memory for source and for destination
and shrink it if needed.
Fixes #750
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 0a06f9c8..4ac163e4 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -5851,7 +5851,7 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
int xDest, int yDest, int w, int h) {
SplashColorPtr p, sp;
unsigned char *q;
- int x, y, mask, srcMask;
+ int x, y, mask, srcMask, width = w, height = h;
if (src->mode != bitmap->mode) {
return splashErrModeMismatch;
@@ -5861,14 +5861,32 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
return splashErrZeroImage;
}
+ if (src->getWidth() - xSrc < width)
+ width = src->getWidth() - xSrc;
+
+ if (src->getHeight() - ySrc < height)
+ height = src->getHeight() - ySrc;
+
+ if (bitmap->getWidth() - xDest < width)
+ width = bitmap->getWidth() - xDest;
+
+ if (bitmap->getHeight() - yDest < height)
+ height = bitmap->getHeight() - yDest;
+
+ if (width < 0)
+ width = 0;
+
+ if (height < 0)
+ height = 0;
+
switch (bitmap->mode) {
case splashModeMono1:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + (xDest >> 3)];
mask = 0x80 >> (xDest & 7);
sp = &src->data[(ySrc + y) * src->rowSize + (xSrc >> 3)];
srcMask = 0x80 >> (xSrc & 7);
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
if (*sp & srcMask) {
*p |= mask;
} else {
@@ -5886,20 +5904,20 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
break;
case splashModeMono8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + xDest];
sp = &src->data[(ySrc + y) * bitmap->rowSize + xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
}
}
break;
case splashModeRGB8:
case splashModeBGR8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 3 * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + 3 * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
*p++ = *sp++;
*p++ = *sp++;
@@ -5907,10 +5925,10 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
break;
case splashModeXBGR8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
*p++ = *sp++;
*p++ = *sp++;
@@ -5921,10 +5939,10 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
break;
#ifdef SPLASH_CMYK
case splashModeCMYK8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
*p++ = *sp++;
*p++ = *sp++;
@@ -5933,10 +5951,10 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
break;
case splashModeDeviceN8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + (SPOT_NCOMPS+4) * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + (SPOT_NCOMPS+4) * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
for (int cp=0; cp < SPOT_NCOMPS+4; cp++)
*p++ = *sp++;
}
@@ -5946,9 +5964,9 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
if (bitmap->alpha) {
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
q = &bitmap->alpha[(yDest + y) * bitmap->width + xDest];
- memset(q, 0x00, w);
+ memset(q, 0x00, width);
}
}

View File

@ -1,100 +0,0 @@
From 8122f6d6d409b53151a20c5578fc525ee97315e8 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 21 Mar 2019 13:47:51 +0100
Subject: [PATCH 2/2] cairo: Constrain number of cycles in rescale filter
Pass address of the first byte after end of the source buffer
to downsample_row_box_filter() so that we can check
that we don't run out of it.
Fixes issue #736
---
poppler/CairoRescaleBox.cc | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index d7615010..7fd07041 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -62,7 +62,7 @@
static void downsample_row_box_filter (
int start, int width,
- uint32_t *src, uint32_t *dest,
+ uint32_t *src, uint32_t *src_limit, uint32_t *dest,
int coverage[], int pixel_coverage)
{
/* we need an array of the pixel contribution of each destination pixel on the boundaries.
@@ -90,13 +90,13 @@ static void downsample_row_box_filter (
/* skip to start */
/* XXX: it might be possible to do this directly instead of iteratively, however
* the iterative solution is simple */
- while (x < start)
+ while (x < start && src < src_limit)
{
int box = 1 << FIXED_SHIFT;
int start_coverage = coverage[x];
box -= start_coverage;
src++;
- while (box >= pixel_coverage)
+ while (box >= pixel_coverage && src < src_limit)
{
src++;
box -= pixel_coverage;
@@ -104,7 +104,7 @@ static void downsample_row_box_filter (
x++;
}
- while (x < start + width)
+ while (x < start + width && src < src_limit)
{
uint32_t a = 0;
uint32_t r = 0;
@@ -121,7 +121,7 @@ static void downsample_row_box_filter (
x++;
box -= start_coverage;
- while (box >= pixel_coverage)
+ while (box >= pixel_coverage && src < src_limit)
{
a += ((*src >> 24) & 0xff) * pixel_coverage;
r += ((*src >> 16) & 0xff) * pixel_coverage;
@@ -135,7 +135,7 @@ static void downsample_row_box_filter (
/* multiply by whatever is leftover
* this ensures that we don't bias down.
* i.e. start_coverage + n*pixel_coverage + box == 1 << 24 */
- if (box > 0)
+ if (box > 0 && src < src_limit)
{
a += ((*src >> 24) & 0xff) * box;
r += ((*src >> 16) & 0xff) * box;
@@ -337,7 +337,7 @@ bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height,
int start_coverage_y = y_coverage[dest_y];
getRow(src_y, scanline);
- downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x);
+ downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x);
columns++;
src_y++;
box -= start_coverage_y;
@@ -345,7 +345,7 @@ bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height,
while (box >= pixel_coverage_y)
{
getRow(src_y, scanline);
- downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x);
+ downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x);
columns++;
src_y++;
box -= pixel_coverage_y;
@@ -355,7 +355,7 @@ bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height,
if (box > 0)
{
getRow(src_y, scanline);
- downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x);
+ downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x);
columns++;
}
--
2.20.1

View File

@ -1,36 +0,0 @@
From 8051f678b3b43326e5fdfd7c03f39de21059f426 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Fri, 5 Apr 2019 16:34:48 +0200
Subject: [PATCH] FontInfoScanner::scanFonts Fix infinite loop in broken files
Fixes #752
---
poppler/FontInfo.cc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 2c3be4c6..cd335771 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -144,7 +144,17 @@ void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, std::vector<FontInfo
Object obj2 = obj1.fetch(xrefA);
if (obj2.isStream()) {
- Object resObj = obj2.streamGetDict()->lookup("Resources");
+ Ref resourcesRef;
+ const Object resObj = obj2.streamGetDict()->lookup("Resources");
+
+ if (resourcesRef.num != -1) {
+ if (visitedObjects.find(resourcesRef.num) != visitedObjects.end()) {
+ continue;
+ }
+
+ visitedObjects.insert(resourcesRef.num);
+ }
+
if (resObj.isDict() && resObj.getDict() != resDict) {
scanFonts(xrefA, resObj.getDict(), fontsList);
}
--
2.20.1

View File

@ -1,20 +0,0 @@
From fada09a2ccc11a3a1d308e810f1336d8df6011fd Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Mon, 18 Mar 2019 00:50:00 +0100
Subject: pdfunite: Fix stack overflow on broken file
Fixes issue #741
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 26842f84..ab4abcad 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1703,7 +1703,7 @@ void PDFDoc::markObject (Object* obj, XRef *xRef, XRef *countRef, unsigned int n
array = obj->getArray();
for (int i=0; i<array->getLength(); i++) {
Object obj1 = array->getNF(i);
- markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum);
+ markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts);
}
break;
case objDict:

View File

@ -0,0 +1,66 @@
From 25feab2736d35ca707bde173b4a7d548da342211 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 2 Jan 2020 13:40:40 +0100
Subject: [PATCH] Revert Remove unused MacroPushRequiredVars.cmake
This is needed by the QT4 removal revert.
---
cmake/modules/MacroPushRequiredVars.cmake | 46 +++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 cmake/modules/MacroPushRequiredVars.cmake
diff --git a/cmake/modules/MacroPushRequiredVars.cmake b/cmake/modules/MacroPushRequiredVars.cmake
new file mode 100644
index 00000000..35a6df5e
--- /dev/null
+++ b/cmake/modules/MacroPushRequiredVars.cmake
@@ -0,0 +1,46 @@
+# this module defines two macros:
+# MACRO_PUSH_REQUIRED_VARS()
+# and
+# MACRO_POP_REQUIRED_VARS()
+# use these if you call cmake macros which use
+# any of the CMAKE_REQUIRED_XXX variables
+#
+# Usage:
+# MACRO_PUSH_REQUIRED_VARS()
+# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
+# CHECK_FUNCTION_EXISTS(...)
+# MACRO_POP_REQUIRED_VARS()
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO(MACRO_PUSH_REQUIRED_VARS)
+
+ IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+ SET(_PUSH_REQUIRED_VARS_COUNTER 0)
+ ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1")
+
+ SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
+ SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
+ SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
+ SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ENDMACRO(MACRO_PUSH_REQUIRED_VARS)
+
+MACRO(MACRO_POP_REQUIRED_VARS)
+
+# don't pop more than we pushed
+ IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1")
+ ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ENDMACRO(MACRO_POP_REQUIRED_VARS)
--
2.24.1

View File

@ -3,8 +3,8 @@
Summary: PDF rendering library
Name: poppler
Version: 0.73.0
Release: 15%{?dist}
Version: 0.84.0
Release: 1%{?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
@ -15,49 +15,15 @@ Source1: %{name}-test-%{test_date}-%{test_sha}.tar.xz
Patch0: poppler-0.30.0-rotated-words-selection.patch
Patch1: 0001-Revert-Remove-the-Qt4-frontend.patch
Patch4: poppler-0.63.0-python3.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1557355
Patch6: poppler-0.63.0-tiling-patterns.patch
Patch2: poppler-0.63.0-tiling-patterns.patch
Patch7: poppler-0.67.0-qt4-const.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1672419
Patch8: poppler-0.73.0-negative-xref-indices.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1665273
Patch9: poppler-0.73.0-check-catalog-is-dict.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1683632
Patch10: poppler-0.73.0-image-stream-getline.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1691724
Patch11: poppler-0.73.0-stack-overflow.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1686802
Patch12: poppler-0.73.0-coverage-values.patch
Patch13: poppler-0.73.0-rescale-filter.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1699862
Patch14: poppler-0.73.0-scan-fonts.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1713582
Patch15: poppler-0.73.0-jpeg2000-component-size.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1696638
Patch16: poppler-0.73.0-overlapping-boxes.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1696637
Patch17: poppler-0.73.0-clip-aa-line.patch
Patch3: poppler-0.67.0-qt4-const.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1696636
Patch18: poppler-0.73.0-PSOutputDev-buffer-read.patch
Patch4: poppler-0.73.0-PSOutputDev-buffer-read.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1732340
Patch19: poppler-0.73.0-JPXStream-length.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1785416
Patch20: poppler-0.73.0-check-scaled-size.patch
Patch5: poppler-0.84.0-MacroPushRequiredVars.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@ -230,9 +196,9 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%ldconfig_scriptlets cpp
%files
%doc README
%doc README.md
%license COPYING
%{_libdir}/libpoppler.so.84*
%{_libdir}/libpoppler.so.94*
%files devel
%{_libdir}/pkgconfig/poppler.pc
@ -289,6 +255,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%{_mandir}/man1/*
%changelog
* Fri Jan 17 2020 Marek Kasik <mkasik@redhat.com> - 0.84.0-1
- Update to 0.84.0
- Resolves: #1673727
* Fri Dec 20 2019 Marek Kasik <mkasik@redhat.com> - 0.73.0-15
- Check scaled dimensions for 0
- Resolves: #1785416

View File

@ -1,2 +1,2 @@
SHA512 (poppler-0.73.0.tar.xz) = 6924a343032573504a0039c56a6263cd1183fa6aca75966fe1f084bd19da78553e455e541a3693896c1ed0c3865f11c11758a0f5a66b2f6cd48ac8a7eccf891a
SHA512 (poppler-0.84.0.tar.xz) = e00aca76b4909621b79ec68374529396ddba756af5d60d86750095dfebbabe5b576aa7c873c3fcfabaff28c89e3e37e826d4a0fac356d76ef966500514a772e7
SHA512 (poppler-test-2018-12-18-45f55f1e03b9bf3fbd334c31776b6f5e472889ec.tar.xz) = fa1d8c92ca5bc9ebd7453dfb78f34fb44d014621fe698aa4a3fa9bd17bd0d302ca6ba36f4dd46a1ef030c0b7a30729d4bacb6d01c5c67d429c897e4f5ab331e8