Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package poppler for openSUSE:Factory checked in at 2022-08-04 13:22:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/poppler (Old) and /work/SRC/openSUSE:Factory/.poppler.new.1521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "poppler" Thu Aug 4 13:22:54 2022 rev:183 rq:992463 version:22.08.0 Changes: -------- --- /work/SRC/openSUSE:Factory/poppler/poppler.changes 2022-07-31 23:00:47.063663924 +0200 +++ /work/SRC/openSUSE:Factory/.poppler.new.1521/poppler.changes 2022-08-04 13:23:04.324432036 +0200 @@ -1,0 +2,8 @@ +Tue Aug 2 19:00:22 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 22.08.0: + * Fix rendering text on some forms + * CairoOutputDev: Support Type3 charprocs having Resources + * Fix crashes on malformed files + +------------------------------------------------------------------- Old: ---- poppler-22.07.0.tar.xz poppler-22.07.0.tar.xz.sig New: ---- poppler-22.08.0.tar.xz poppler-22.08.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ poppler.spec ++++++ --- /var/tmp/diff_new_pack.X0L6C2/_old 2022-08-04 13:23:04.824433455 +0200 +++ /var/tmp/diff_new_pack.X0L6C2/_new 2022-08-04 13:23:04.828433467 +0200 @@ -24,7 +24,7 @@ %endif # Actual version of poppler-data: %define poppler_data_version 0.4.11 -%define poppler_sover 122 +%define poppler_sover 123 %define poppler_cpp_sover 0 %define poppler_glib_sover 8 %define poppler_qt5_sover 1 @@ -32,7 +32,7 @@ %define poppler_api 0.18 %define poppler_apipkg 0_18 Name: poppler%{?psuffix} -Version: 22.07.0 +Version: 22.08.0 Release: 0 Summary: PDF Rendering Library License: GPL-2.0-only OR GPL-3.0-only ++++++ poppler-22.07.0.tar.xz -> poppler-22.08.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/.gitlab-ci.yml new/poppler-22.08.0/.gitlab-ci.yml --- old/poppler-22.07.0/.gitlab-ci.yml 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/.gitlab-ci.yml 2022-08-01 23:11:55.000000000 +0200 @@ -89,12 +89,12 @@ - mingw64-cmake -G Ninja .. - ninja -build_clazy_clang13: +build_clazy_clang14: stage: build script: - - apt-get install --yes --no-install-recommends clazy clang-13 + - apt-get install --yes --no-install-recommends clazy clang-14 - mkdir -p build && cd build - - CC=clang-13 CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -G Ninja .. + - CC=clang-14 CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -G Ninja .. - CLAZY_CHECKS="level0,level1,level2,isempty-vs-count,qhash-with-char-pointer-key,tr-non-literal,no-non-pod-global-static" ninja build_android: @@ -132,6 +132,19 @@ paths: - qt5/src/APIDOCS-html +qt6_docs: + only: + - master + stage: document + script: + - apt-get install --yes --no-install-recommends doxygen graphviz qt6-documentation-tools + - cd qt6/src + - ( cat Doxyfile ; echo "QHG_LOCATION=/usr/lib/qt6/bin/qhelpgenerator" ) | doxygen - + cache: {} + artifacts: + paths: + - qt6/src/APIDOCS-html + cpp_docs: only: - master diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/CMakeLists.txt new/poppler-22.08.0/CMakeLists.txt --- old/poppler-22.07.0/CMakeLists.txt 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/CMakeLists.txt 2022-08-01 23:11:55.000000000 +0200 @@ -39,7 +39,7 @@ endif() set(POPPLER_MAJOR_VERSION "22") -set(POPPLER_MINOR_VERSION_STRING "07") +set(POPPLER_MINOR_VERSION_STRING "08") # We want the string version to have 08 but the integer version can't have a leading 0 since otherwise it's considered octal # So strip a leading 0 if found in POPPLER_MINOR_VERSION_STRING and store the result in POPPLER_MINOR_VERSION string(REGEX REPLACE "^0?(.+)$" "\\1" POPPLER_MINOR_VERSION "${POPPLER_MINOR_VERSION_STRING}") @@ -579,7 +579,7 @@ endif() add_library(poppler ${poppler_SRCS}) generate_export_header(poppler BASE_NAME poppler-private EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/poppler_private_export.h") -set_target_properties(poppler PROPERTIES VERSION 122.0.0 SOVERSION 122) +set_target_properties(poppler PROPERTIES VERSION 123.0.0 SOVERSION 123) if(MINGW AND BUILD_SHARED_LIBS) get_target_property(POPPLER_SOVERSION poppler SOVERSION) set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/ChangeLog new/poppler-22.08.0/ChangeLog --- old/poppler-22.07.0/ChangeLog 2022-07-04 20:12:04.000000000 +0200 +++ new/poppler-22.08.0/ChangeLog 2022-08-01 23:14:31.000000000 +0200 @@ -1,3 +1,148 @@ +commit 12853d22e9d0527c10ada02666aef629db3e5e7c +Author: Albert Astals Cid <aa...@kde.org> +Date: Mon Aug 1 23:06:48 2022 +0200 + + 22.08.0 + + CMakeLists.txt | 4 ++-- + NEWS | 6 ++++++ + cpp/Doxyfile | 2 +- + qt5/src/Doxyfile | 2 +- + qt6/src/Doxyfile | 2 +- + 5 files changed, 11 insertions(+), 5 deletions(-) + +commit 78e939131f868e3ea6541ee1c096d82cd548e706 +Author: Albert Astals Cid <aa...@kde.org> +Date: Mon Aug 1 21:33:25 2022 +0200 + + Fix infinite recursion in broken files + + oss-fuzz/49702 + + poppler/Annot.cc | 31 +++++++++++++++++++++++++++---- + 1 file changed, 27 insertions(+), 4 deletions(-) + +commit a89c3c27e02e9c300aa667c966d91fdf787c7d0a +Author: Albert Astals Cid <aa...@kde.org> +Date: Sat Jul 30 19:13:31 2022 +0200 + + Merge Form DR into widget DR + + Fixes #1189 + Fixes #1267 + + poppler/Annot.cc | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +commit e57106ffc5b2589e6d1e11182f1ff9e5370848f2 +Author: Albert Astals Cid <aa...@kde.org> +Date: Mon Aug 1 00:00:11 2022 +0200 + + Update clang used for clazy + + .gitlab-ci.yml | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 8677500399fc2548fa816b619580c2c07915a98c +Author: Albert Astals Cid <aa...@kde.org> +Date: Fri Jul 29 23:28:35 2022 +0200 + + pdfseparate: Account for XRef::add failing because we run out + of memory + + Fixes #1278 + + poppler/PDFDoc.cc | 63 + ++++++++++++++++++++++++++++++++++++++++++------------- + poppler/PDFDoc.h | 6 +++--- + poppler/XRef.cc | 11 ++++++++-- + poppler/XRef.h | 4 ++-- + 4 files changed, 62 insertions(+), 22 deletions(-) + +commit ae6be1946e4eefd0d4f798930f9dfbb6fe332959 +Author: Albert Astals Cid <aa...@kde.org> +Date: Fri Jul 29 22:52:57 2022 +0200 + + Update (C) + + and fix format, somehow i landed this without waiting for CI results, + bad bad Albert + + utils/pdfunite.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +commit 4631115647c1e4f0482ffe0491c2f38d2231337b +Author: crt <ch...@cse.cuhk.edu.hk> +Date: Fri Jul 29 20:51:11 2022 +0000 + + Check isDict before calling getDict + + Issue #1276 + + utils/pdfunite.cc | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +commit cb1f2a685461b60e05d503165d05ea6c557ff277 +Author: Albert Astals Cid <aa...@kde.org> +Date: Fri Jul 29 20:59:28 2022 +0200 + + JBIG2Stream: Fix crash on broken files + + oss-fuzz/49406 + + poppler/JBIG2Stream.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +commit 8f874169e5d43418873b40e86954b86c01f7ba99 +Author: Albert Astals Cid <aa...@kde.org> +Date: Fri Jul 29 16:26:20 2022 +0200 + + Generate qt6 docs + + .gitlab-ci.yml | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +commit b443f529a1a35b9d5028cb95c6dcc0111e1acec1 +Author: Albert Astals Cid <aa...@kde.org> +Date: Fri Jul 29 00:25:33 2022 +0200 + + Update (C) + + poppler/CairoFontEngine.cc | 1 + + poppler/PDFDoc.cc | 1 + + 2 files changed, 2 insertions(+) + +commit 2e3c53b71f78b13f2afdb122c2d59243de70ac45 +Author: Albert Astals Cid <aa...@kde.org> +Date: Thu Jul 28 01:10:27 2022 +0200 + + Fix leak in early return check that was just introduced + + poppler/PDFDoc.cc | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +commit dcd5bd8238ea448addd102ff045badd0aca1b990 +Author: crt <ch...@cse.cuhk.edu.hk> +Date: Wed Jul 27 08:40:02 2022 +0000 + + pdfseparate: Check XRef's Catalog for being a Dict + + poppler/PDFDoc.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +commit b96437128742e87a7603fa2a4d74baeda8368fba +Author: Marcel Fabian Kr??ger <t...@2krueger.de> +Date: Thu Jul 21 23:47:39 2022 +0200 + + Support Type3 charprocs having Resources in Cairo + + In !955 the same was done for OutputDevs with + interpretType3Chars()=true, + this adds similar handling to CairoFontEngine. + + poppler/CairoFontEngine.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + commit bb1651334abc11495fa0326c8d562243d2a4b055 Author: Albert Astals Cid <aa...@kde.org> Date: Mon Jul 4 20:09:04 2022 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/NEWS new/poppler-22.08.0/NEWS --- old/poppler-22.07.0/NEWS 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/NEWS 2022-08-01 23:11:55.000000000 +0200 @@ -1,3 +1,9 @@ +Release 22.08.0: + core: + * Fix rendering text on some forms + * CairoOutputDev: Support Type3 charprocs having Resources + * Fix crashes on malformed files + Release 22.07.0: core: * Fix crash when filling in forms in some files. Issue #1258 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/cpp/Doxyfile new/poppler-22.08.0/cpp/Doxyfile --- old/poppler-22.07.0/cpp/Doxyfile 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/cpp/Doxyfile 2022-08-01 23:11:55.000000000 +0200 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 22.07.0 +PROJECT_NUMBER = 22.08.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/glib/reference/html/index.html new/poppler-22.08.0/glib/reference/html/index.html --- old/poppler-22.07.0/glib/reference/html/index.html 2022-07-04 20:11:06.000000000 +0200 +++ new/poppler-22.08.0/glib/reference/html/index.html 2022-08-01 23:13:31.000000000 +0200 @@ -15,7 +15,7 @@ <div> <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">Poppler Reference Manual</p></th></tr></table></div> <div><p class="releaseinfo"> - for Poppler 22.07.0 + for Poppler 22.08.0 </p></div> </div> <hr> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/glib/reference/html/poppler-Poppler-Features.html new/poppler-22.08.0/glib/reference/html/poppler-Poppler-Features.html --- old/poppler-22.07.0/glib/reference/html/poppler-Poppler-Features.html 2022-07-04 20:11:06.000000000 +0200 +++ new/poppler-22.08.0/glib/reference/html/poppler-Poppler-Features.html 2022-08-01 23:13:32.000000000 +0200 @@ -205,7 +205,7 @@ <hr> <div class="refsect2"> <a name="POPPLER-MINOR-VERSION:CAPS"></a><h3>POPPLER_MINOR_VERSION</h3> -<pre class="programlisting">#define POPPLER_MINOR_VERSION (7) +<pre class="programlisting">#define POPPLER_MINOR_VERSION (8) </pre> <p>The major version number of the poppler header files (e.g. in poppler version 0.1.2 this is 1.)</p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/poppler/Annot.cc new/poppler-22.08.0/poppler/Annot.cc --- old/poppler-22.07.0/poppler/Annot.cc 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/poppler/Annot.cc 2022-08-01 23:11:55.000000000 +0200 @@ -5347,6 +5347,48 @@ return true; } +static bool insertIfNotAlreadyPresent(Ref r, std::set<int> *alreadySeenDicts) +{ + if (r == Ref::INVALID()) { + return true; + } + + // std::pair<iterator,bool> + const auto insertResult = alreadySeenDicts->insert(r.num); + return insertResult.second; +} + +// Should we also merge Arrays? +static void recursiveMergeDicts(Dict *primary, const Dict *secondary, std::set<int> *alreadySeenDicts) +{ + for (int i = 0; i < secondary->getLength(); ++i) { + const char *key = secondary->getKey(i); + if (!primary->hasKey(key)) { + primary->add(key, secondary->lookup(key).deepCopy()); + } else { + Ref primaryRef; + Object primaryObj = primary->lookup(key, &primaryRef); + if (primaryObj.isDict()) { + Ref secondaryRef; + Object secondaryObj = secondary->lookup(key, &secondaryRef); + if (secondaryObj.isDict()) { + if (!insertIfNotAlreadyPresent(primaryRef, alreadySeenDicts) || !insertIfNotAlreadyPresent(secondaryRef, alreadySeenDicts)) { + // bad PDF + return; + } + recursiveMergeDicts(primaryObj.getDict(), secondaryObj.getDict(), alreadySeenDicts); + } + } + } + } +} + +static void recursiveMergeDicts(Dict *primary, const Dict *secondary) +{ + std::set<int> alreadySeenDicts; + recursiveMergeDicts(primary, secondary, &alreadySeenDicts); +} + void AnnotWidget::generateFieldAppearance() { const GooString *da; @@ -5385,7 +5427,11 @@ // Let's use a field's resource dictionary. resourcesDictObj = field->getObj()->dictLookup("DR"); if (resourcesDictObj.isDict()) { - resourcesToFree = new GfxResources(doc->getXRef(), resourcesDictObj.getDict(), form ? form->getDefaultResources() : nullptr); + if (form && form->getDefaultResourcesObj()->isDict()) { + resourcesDictObj = resourcesDictObj.deepCopy(); + recursiveMergeDicts(resourcesDictObj.getDict(), form->getDefaultResourcesObj()->getDict()); + } + resourcesToFree = new GfxResources(doc->getXRef(), resourcesDictObj.getDict(), nullptr); resources = resourcesToFree; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/poppler/CairoFontEngine.cc new/poppler-22.08.0/poppler/CairoFontEngine.cc --- old/poppler-22.07.0/poppler/CairoFontEngine.cc 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/poppler/CairoFontEngine.cc 2022-08-01 23:11:55.000000000 +0200 @@ -32,6 +32,7 @@ // Copyright (C) 2019 Christian Persch <c...@src.gnome.org> // Copyright (C) 2020 Michal <sudols...@gmail.com> // Copyright (C) 2021, 2022 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2022 Marcel Fabian Kr??ger <t...@2krueger.de> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -484,7 +485,17 @@ output_dev->startType3Render(gfx->getState(), gfx->getXRef()); output_dev->setInType3Char(true); charProc = charProcs->getVal(glyph); + if (!charProc.isStream()) { + return CAIRO_STATUS_USER_FONT_ERROR; + } + Object charProcResObject = charProc.streamGetDict()->lookup("Resources"); + if (charProcResObject.isDict()) { + gfx->pushResources(charProcResObject.getDict()); + } gfx->display(&charProc); + if (charProcResObject.isDict()) { + gfx->popResources(); + } output_dev->getType3GlyphWidth(&wx, &wy); cairo_matrix_transform_distance(&matrix, &wx, &wy); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/poppler/JBIG2Stream.cc new/poppler-22.08.0/poppler/JBIG2Stream.cc --- old/poppler-22.07.0/poppler/JBIG2Stream.cc 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/poppler/JBIG2Stream.cc 2022-08-01 23:11:55.000000000 +0200 @@ -2751,6 +2751,10 @@ if (imm) { if (pageH == 0xffffffff && y + h > curPageH) { pageBitmap->expand(y + h, pageDefPixel); + if (!pageBitmap->isOk()) { + error(errSyntaxError, curStr->getPos(), "JBIG2Stream::readGenericRegionSeg: expand failed"); + return; + } } pageBitmap->combine(bitmap.get(), x, y, extCombOp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/poppler/PDFDoc.cc new/poppler-22.08.0/poppler/PDFDoc.cc --- old/poppler-22.07.0/poppler/PDFDoc.cc 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/poppler/PDFDoc.cc 2022-08-01 23:11:55.000000000 +0200 @@ -52,6 +52,7 @@ // Copyright (C) 2021 Georgiy Sgibnev <geor...@sgibnev.com>. Work sponsored by lab50.net. // Copyright (C) 2021-2022 Marek Kasik <mka...@redhat.com> // Copyright (C) 2022 Felix Jung <fxj...@posteo.de> +// Copyright (C) 2022 crt <ch...@cse.cuhk.edu.hk> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -886,6 +887,14 @@ // get and mark output intents etc. Object catObj = getXRef()->getCatalog(); + if (!catObj.isDict()) { + fclose(f); + delete yRef; + delete countRef; + delete outStr; + error(errSyntaxError, -1, "XRef's Catalog is not a dictionary"); + return errOpenFile; + } Dict *catDict = catObj.getDict(); Object pagesObj = catDict->lookup("Pages"); Object afObj = catDict->lookupNF("AcroForm").copy(); @@ -897,7 +906,14 @@ if (resourcesObj.isDict()) { markPageObjects(resourcesObj.getDict(), yRef, countRef, 0, refPage->num, rootNum + 2); } - markPageObjects(catDict, yRef, countRef, 0, refPage->num, rootNum + 2); + if (!markPageObjects(catDict, yRef, countRef, 0, refPage->num, rootNum + 2)) { + fclose(f); + delete yRef; + delete countRef; + delete outStr; + error(errSyntaxError, -1, "markPageObjects failed"); + return errDamaged; + } Dict *pageDict = page.getDict(); if (resourcesObj.isNull() && !pageDict->hasKey("Resources")) { @@ -1628,7 +1644,7 @@ outStr->printf("%%%c%c%c%c\n", 0xE2, 0xE3, 0xCF, 0xD3); } -void PDFDoc::markDictionnary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) +bool PDFDoc::markDictionnary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) { bool deleteSet = false; if (!alreadyMarkedDicts) { @@ -1641,7 +1657,7 @@ if (deleteSet) { delete alreadyMarkedDicts; } - return; + return true; } else { alreadyMarkedDicts->insert(dict); } @@ -1650,7 +1666,10 @@ const char *key = dict->getKey(i); if (strcmp(key, "Annots") != 0) { Object obj1 = dict->getValNF(i).copy(); - markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + const bool success = markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + if (unlikely(!success)) { + return false; + } } else { Object annotsObj = dict->getValNF(i).copy(); if (!annotsObj.isNull()) { @@ -1662,9 +1681,11 @@ if (deleteSet) { delete alreadyMarkedDicts; } + + return true; } -void PDFDoc::markObject(Object *obj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) +bool PDFDoc::markObject(Object *obj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) { Array *array; @@ -1673,22 +1694,34 @@ array = obj->getArray(); for (int i = 0; i < array->getLength(); i++) { Object obj1 = array->getNF(i).copy(); - markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + const bool success = markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + if (unlikely(!success)) { + return false; + } } break; - case objDict: - markDictionnary(obj->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); - break; + case objDict: { + const bool success = markDictionnary(obj->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + if (unlikely(!success)) { + return false; + } + } break; case objStream: { Stream *stream = obj->getStream(); - markDictionnary(stream->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + const bool success = markDictionnary(stream->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + if (unlikely(!success)) { + return false; + } } break; case objRef: { if (obj->getRef().num + (int)numOffset >= xRef->getNumObjects() || xRef->getEntry(obj->getRef().num + numOffset)->type == xrefEntryFree) { if (getXRef()->getEntry(obj->getRef().num)->type == xrefEntryFree) { - return; // already marked as free => should be replaced + return true; // already marked as free => should be replaced + } + const bool success = xRef->add(obj->getRef().num + numOffset, obj->getRef().gen, 0, true); + if (unlikely(!success)) { + return false; } - xRef->add(obj->getRef().num + numOffset, obj->getRef().gen, 0, true); if (getXRef()->getEntry(obj->getRef().num)->type == xrefEntryCompressed) { xRef->getEntry(obj->getRef().num + numOffset)->type = xrefEntryCompressed; } @@ -1703,11 +1736,16 @@ } } Object obj1 = getXRef()->fetch(obj->getRef()); - markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum); + const bool success = markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum); + if (unlikely(!success)) { + return false; + } } break; default: break; } + + return true; } void PDFDoc::replacePageDict(int pageNo, int rotate, const PDFRectangle *mediaBox, const PDFRectangle *cropBox) @@ -1745,7 +1783,7 @@ getXRef()->setModifiedObject(&page, *refPage); } -void PDFDoc::markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) +bool PDFDoc::markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) { pageDict->remove("OpenAction"); pageDict->remove("Outlines"); @@ -1755,9 +1793,13 @@ const char *key = pageDict->getKey(n); Object value = pageDict->getValNF(n).copy(); if (strcmp(key, "Parent") != 0 && strcmp(key, "Pages") != 0 && strcmp(key, "AcroForm") != 0 && strcmp(key, "Annots") != 0 && strcmp(key, "P") != 0 && strcmp(key, "Root") != 0) { - markObject(&value, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + const bool success = markObject(&value, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + if (unlikely(!success)) { + return false; + } } } + return true; } bool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldPageNum, int newPageNum, std::set<Dict *> *alreadyMarkedDicts) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/poppler/PDFDoc.h new/poppler-22.08.0/poppler/PDFDoc.h --- old/poppler-22.07.0/poppler/PDFDoc.h 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/poppler/PDFDoc.h 2022-08-01 23:11:55.000000000 +0200 @@ -318,7 +318,7 @@ // rewrite pageDict with MediaBox, CropBox and new page CTM void replacePageDict(int pageNo, int rotate, const PDFRectangle *mediaBox, const PDFRectangle *cropBox); - void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts = nullptr); + bool markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts = nullptr); bool markAnnotations(Object *annots, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldPageNum, int newPageNum, std::set<Dict *> *alreadyMarkedDicts = nullptr); void markAcroForm(Object *afObj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum); // write all objects used by pageDict to outStr @@ -343,8 +343,8 @@ private: // insert referenced objects in XRef - void markDictionnary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts); - void markObject(Object *obj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts = nullptr); + bool markDictionnary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts); + bool markObject(Object *obj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts = nullptr); static void writeDictionnary(Dict *dict, OutStream *outStr, XRef *xRef, unsigned int numOffset, unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, Ref ref, std::set<Dict *> *alreadyWrittenDicts); // Write object header to current file stream and return its offset diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/poppler/XRef.cc new/poppler-22.08.0/poppler/XRef.cc --- old/poppler-22.07.0/poppler/XRef.cc 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/poppler/XRef.cc 2022-08-01 23:11:55.000000000 +0200 @@ -1380,12 +1380,18 @@ add(ref.num, ref.gen, offs, used); } -void XRef::add(int num, int gen, Goffset offs, bool used) +bool XRef::add(int num, int gen, Goffset offs, bool used) { xrefLocker(); if (num >= size) { if (num >= capacity) { - entries = (XRefEntry *)greallocn(entries, num + 1, sizeof(XRefEntry)); + entries = (XRefEntry *)greallocn_checkoverflow(entries, num + 1, sizeof(XRefEntry)); + if (unlikely(entries == nullptr)) { + size = 0; + capacity = 0; + return false; + } + capacity = num + 1; } for (int i = size; i < num + 1; ++i) { @@ -1408,6 +1414,7 @@ e->type = xrefEntryFree; e->offset = 0; } + return true; } void XRef::setModifiedObject(const Object *o, Ref r) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/poppler/XRef.h new/poppler-22.08.0/poppler/XRef.h --- old/poppler-22.07.0/poppler/XRef.h 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/poppler/XRef.h 2022-08-01 23:11:55.000000000 +0200 @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <br...@frogmouth.net> -// Copyright (C) 2006, 2008, 2010-2013, 2017-2021 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2006, 2008, 2010-2013, 2017-2022 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2007-2008 Julien Rebetez <juli...@svn.gnome.org> // Copyright (C) 2007 Carlos Garcia Campos <carlo...@gnome.org> // Copyright (C) 2010 Ilya Gorenbein <igorenb...@finjan.com> @@ -207,7 +207,7 @@ void setModifiedObject(const Object *o, Ref r); Ref addIndirectObject(const Object &o); void removeIndirectObject(Ref r); - void add(int num, int gen, Goffset offs, bool used); + bool add(int num, int gen, Goffset offs, bool used); void add(Ref ref, Goffset offs, bool used); // Adds a stream object using AutoFreeMemStream. // The function takes ownership over dict and buffer. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/qt5/src/Doxyfile new/poppler-22.08.0/qt5/src/Doxyfile --- old/poppler-22.07.0/qt5/src/Doxyfile 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/qt5/src/Doxyfile 2022-08-01 23:11:55.000000000 +0200 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 22.07.0 +PROJECT_NUMBER = 22.08.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/qt6/src/Doxyfile new/poppler-22.08.0/qt6/src/Doxyfile --- old/poppler-22.07.0/qt6/src/Doxyfile 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/qt6/src/Doxyfile 2022-08-01 23:11:55.000000000 +0200 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 22.07.0 +PROJECT_NUMBER = 22.08.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.07.0/utils/pdfunite.cc new/poppler-22.08.0/utils/pdfunite.cc --- old/poppler-22.07.0/utils/pdfunite.cc 2022-07-04 20:09:04.000000000 +0200 +++ new/poppler-22.08.0/utils/pdfunite.cc 2022-08-01 23:11:55.000000000 +0200 @@ -15,6 +15,7 @@ // Copyright (C) 2018 Adam Reichold <adam.reich...@t-online.de> // Copyright (C) 2019 Marek Kasik <mka...@redhat.com> // Copyright (C) 2019 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2022 crt <ch...@cse.cuhk.edu.hk> // //======================================================================== @@ -197,6 +198,14 @@ Object ocObj; if (docs.size() >= 1) { Object catObj = docs[0]->getXRef()->getCatalog(); + if (!catObj.isDict()) { + fclose(f); + delete yRef; + delete countRef; + delete outStr; + error(errSyntaxError, -1, "XRef's Catalog is not a dictionary."); + return -1; + } Dict *catDict = catObj.getDict(); intents = catDict->lookup("OutputIntents"); afObj = catDict->lookupNF("AcroForm").copy(); @@ -295,6 +304,14 @@ } } Object pageCatObj = docs[i]->getXRef()->getCatalog(); + if (!pageCatObj.isDict()) { + fclose(f); + delete yRef; + delete countRef; + delete outStr; + error(errSyntaxError, -1, "XRef's Catalog is not a dictionary."); + return -1; + } Dict *pageCatDict = pageCatObj.getDict(); Object pageNames = pageCatDict->lookup("Names"); if (!pageNames.isNull() && pageNames.isDict()) {