From 6748cfc84ffef2bfa2328f1da7c70a99d93e0807 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 1 Dec 2023 10:31:59 +0100 Subject: [PATCH 01/11] poppler 23.12.0 --- CMakeLists.txt | 2 +- NEWS | 5 +++++ cpp/Doxyfile | 2 +- qt5/src/Doxyfile | 2 +- qt6/src/Doxyfile | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 766d13195..e1e8d138e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ if (ECM_FOUND) endif() set(POPPLER_MAJOR_VERSION "23") -set(POPPLER_MINOR_VERSION_STRING "11") +set(POPPLER_MINOR_VERSION_STRING "12") # 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}") diff --git a/NEWS b/NEWS index 9ffaf173b..950c674ea 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Release 23.12.0: + core: + * Rewrite FoFiType1::parse to be more flexible. Issue #1422 + * Small internal code refactoring + Release 23.11.0: core: * CairoOutputDev: Use internal downscaling algorithm if image exceeds Cairo's maximum dimensions. diff --git a/cpp/Doxyfile b/cpp/Doxyfile index fe372f90f..6cca9bb6c 100644 --- a/cpp/Doxyfile +++ b/cpp/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler CPP" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 23.11.0 +PROJECT_NUMBER = 23.12.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/qt5/src/Doxyfile b/qt5/src/Doxyfile index 6dba49594..b09b48e8f 100644 --- a/qt5/src/Doxyfile +++ b/qt5/src/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler Qt5" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 23.11.0 +PROJECT_NUMBER = 23.12.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/qt6/src/Doxyfile b/qt6/src/Doxyfile index 52502ec48..40c56177e 100644 --- a/qt6/src/Doxyfile +++ b/qt6/src/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler Qt6" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 23.11.0 +PROJECT_NUMBER = 23.12.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. From 4634bfdaeb46bb981413f247b1cfe82674a5f113 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sat, 9 Dec 2023 01:17:21 +0100 Subject: [PATCH 02/11] CI: Fix build_clang16_libcpp --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a1cfb290..2817a9335 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,8 +56,8 @@ build_clang16_libcpp: - srcdir=`pwd` && mkdir -p /tmp/poppler_build && cd /tmp/poppler_build - clang++-16 -fPIC -shared -o goostring-format-checker.so $srcdir/test/goostring-format-checker/goostring-format-checker.cc -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I /usr/lib/llvm-16/include/ - echo "We disable Qt6 tests since Qt6 exposes std::string in its ABI which makes it not build in this CI since we're using libc++ but Qt6 in debian is build with libstdc++" - - CC=clang-16 CXX=clang++-16 cmake -G Ninja -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Xclang -load -Xclang $PWD/goostring-format-checker.so -Xclang -add-plugin -Xclang goostring-format-checker -Werror -Wno-deprecated-declarations" -DTESTDATADIR=$srcdir/test-data -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_QT6_TESTS=OFF -DENABLE_GPGME=OFF $srcdir - - ninja -j ${FDO_CI_CONCURRENT} + - CC=clang-16 CXX=clang++-16 cmake -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Xclang -load -Xclang $PWD/goostring-format-checker.so -Xclang -add-plugin -Xclang goostring-format-checker -Werror -Wno-deprecated-declarations" -DTESTDATADIR=$srcdir/test-data -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_QT6_TESTS=OFF -DENABLE_GPGME=OFF $srcdir + - make -j ${FDO_CI_CONCURRENT} - ctest --output-on-failure - echo "This is a complex way of not running clang-tidy over autogenerated files, unfortunately -DCMAKE_CXX_CLANG_TIDY doesn't support that https://gitlab.kitware.com/cmake/cmake/-/issues/19772" - cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json From 3d870122d70c3b3327d93eb761eb14003cc745a7 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 10 Dec 2023 22:40:58 +0100 Subject: [PATCH 03/11] We require an openjpeg >= 2.1 --- poppler/JPEG2000Stream.cc | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc index c480ba273..94ed0dd51 100644 --- a/poppler/JPEG2000Stream.cc +++ b/poppler/JPEG2000Stream.cc @@ -20,17 +20,6 @@ #include "JPEG2000Stream.h" #include -#define OPENJPEG_VERSION_ENCODE(major, minor, micro) (((major)*10000) + ((minor)*100) + ((micro)*1)) - -#ifdef OPJ_VERSION_MAJOR -# define OPENJPEG_VERSION OPENJPEG_VERSION_ENCODE(OPJ_VERSION_MAJOR, OPJ_VERSION_MINOR, OPJ_VERSION_BUILD) -#else -// OpenJPEG started providing version macros in version 2.1. -// If the version macro is not found, set the version to 2.0.0 and -// assume there will be no API changes in 2.0.x. -# define OPENJPEG_VERSION OPENJPEG_VERSION_ENCODE(2, 0, 0) -#endif - struct JPXStreamPrivate { opj_image_t *image = nullptr; @@ -333,11 +322,7 @@ void JPXStreamPrivate::init2(OPJ_CODEC_FORMAT format, const unsigned char *buf, stream = opj_stream_default_create(OPJ_TRUE); -#if OPENJPEG_VERSION >= OPENJPEG_VERSION_ENCODE(2, 1, 0) opj_stream_set_user_data(stream, &jpxData, nullptr); -#else - opj_stream_set_user_data(stream, &jpxData); -#endif opj_stream_set_read_function(stream, jpxRead_callback); opj_stream_set_skip_function(stream, jpxSkip_callback); From cf9210568ebd45de13e2f225090df1c9bdfa8248 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 10 Dec 2023 23:49:15 +0100 Subject: [PATCH 04/11] Fix build on Android with generic font configuration --- poppler/GlobalParams.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc index 46c349f7e..70e4036bd 100644 --- a/poppler/GlobalParams.cc +++ b/poppler/GlobalParams.cc @@ -1560,7 +1560,9 @@ void GlobalParams::setErrQuiet(bool errQuietA) #ifdef ANDROID void GlobalParams::setFontDir(const std::string &fontDir) { +# if defined(WITH_FONTCONFIGURATION_ANDROID) displayFontDir = fontDir; +# endif } #endif From 6fa6d41d046e440165e899a84a38da2c1ec146ed Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 10 Dec 2023 23:44:42 +0100 Subject: [PATCH 05/11] CI: Add android generic build --- .gitlab-ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2817a9335..5428cf68f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -131,6 +131,32 @@ build_qt5_android: -DCMAKE_TOOLCHAIN_FILE=/opt/nativetooling/share/ECM/toolchain/Android.cmake' - ninja -j ${FDO_CI_CONCURRENT} +build_qt5_android_generic: + stage: build + image: kdeorg/android-sdk + before_script: + - echo "workaround for ECM Android toolchain wanting all binaries to be shared libraries" + - sed -i -e 's/ //g' /opt/nativetooling/share/ECM/toolchain/Android.cmake + script: + - mkdir -p build && cd build + - 'ANDROID_ARCH_ABI=arm64-v8a cmake -G Ninja .. + -DCMAKE_ANDROID_API=28 + -DCMAKE_PREFIX_PATH="/opt/Qt/;/opt/kdeandroid-arm64/" + -DCMAKE_BUILD_TYPE=debug + -DCMAKE_POSITION_INDEPENDENT_CODE=OFF + -DENABLE_DCTDECODER=unmaintained + -DENABLE_LIBOPENJPEG=unmaintained + -DENABLE_BOOST=OFF + -DENABLE_LCMS=OFF + -DENABLE_LIBCURL=OFF + -DENABLE_LIBTIFF=OFF + -DENABLE_QT6=OFF + -DENABLE_NSS3=OFF + -DENABLE_GPGME=OFF + -DFONT_CONFIGURATION=generic + -DCMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations" + -DCMAKE_TOOLCHAIN_FILE=/opt/nativetooling/share/ECM/toolchain/Android.cmake' + - ninja -j ${FDO_CI_CONCURRENT} build_qt6_android: stage: build From 37023cdfc15600cd58303147dc99254c119c51c4 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 13 Dec 2023 23:08:44 +0100 Subject: [PATCH 06/11] Update (C) --- poppler/JPEG2000Stream.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc index 94ed0dd51..4d68f9552 100644 --- a/poppler/JPEG2000Stream.cc +++ b/poppler/JPEG2000Stream.cc @@ -4,7 +4,7 @@ // // A JPX stream decoder using OpenJPEG // -// Copyright 2008-2010, 2012, 2017-2022 Albert Astals Cid +// Copyright 2008-2010, 2012, 2017-2023 Albert Astals Cid // Copyright 2011 Daniel Glöckner // Copyright 2014, 2016 Thomas Freitag // Copyright 2013, 2014 Adrian Johnson From afaddf1be66aed2931a146bb6555225c82cceacd Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 14 Dec 2023 00:48:45 +0100 Subject: [PATCH 07/11] NSSCryptoSignBackend: Don't crash on certain documents --- poppler/NSSCryptoSignBackend.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/poppler/NSSCryptoSignBackend.cc b/poppler/NSSCryptoSignBackend.cc index ab0d2890f..dd61d4ed8 100644 --- a/poppler/NSSCryptoSignBackend.cc +++ b/poppler/NSSCryptoSignBackend.cc @@ -776,10 +776,18 @@ NSSSignatureVerification::NSSSignatureVerification(std::vector && CMSSignedData = CMS_SignedDataCreate(CMSMessage); if (CMSSignedData) { CMSSignerInfo = CMS_SignerInfoCreate(CMSSignedData); - SECItem usedAlgorithm = NSS_CMSSignedData_GetDigestAlgs(CMSSignedData)[0]->algorithm; - auto hashAlgorithm = SECOID_FindOIDTag(&usedAlgorithm); - HASH_HashType hashType = HASH_GetHashTypeByOidTag(hashAlgorithm); - hashContext = HashContext::create(ConvertHashTypeFromNss(hashType)); + SECAlgorithmID **algs = NSS_CMSSignedData_GetDigestAlgs(CMSSignedData); + while (*algs != nullptr) { + SECItem usedAlgorithm = (*algs)->algorithm; + auto hashAlgorithm = SECOID_FindOIDTag(&usedAlgorithm); + HASH_HashType hashType = HASH_GetHashTypeByOidTag(hashAlgorithm); + hashContext = HashContext::create(ConvertHashTypeFromNss(hashType)); + + if (hashContext) { + break; + } + ++algs; + } } } From 4fb6a9bc495fa7059e7eed8adb5d46bed44809be Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Fri, 8 Dec 2023 17:16:38 +0900 Subject: [PATCH 08/11] Initialize FontInfo::embRef by Ref::INVALID() for Type3 font. --- poppler/FontInfo.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc index 8fb4f3e77..d1b8d2e17 100644 --- a/poppler/FontInfo.cc +++ b/poppler/FontInfo.cc @@ -175,6 +175,7 @@ FontInfo::FontInfo(GfxFont *font, XRef *xref) // check for an embedded font if (font->getType() == fontType3) { emb = true; + embRef = Ref::INVALID(); } else { emb = font->getEmbeddedFontID(&embRef); } From 4be9ecdadcacf52dc0e413c30d09a61384a36166 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sat, 23 Dec 2023 01:00:02 +0100 Subject: [PATCH 09/11] Update (C) --- poppler/FontInfo.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc index d1b8d2e17..2f1ff7fc4 100644 --- a/poppler/FontInfo.cc +++ b/poppler/FontInfo.cc @@ -15,6 +15,7 @@ // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2018, 2019 Adam Reichold // Copyright (C) 2019, 2021, 2022 Oliver Sander +// Copyright (C) 2023 Suzuki Toshiya // // 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 From 8a9f1d3a84a9f3d66cd353b7fe1aef0b65a37c08 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 28 Dec 2023 18:35:21 +0100 Subject: [PATCH 10/11] Fix infinite loop in HorizontalTextLayouter if there's not enough space to layout text Happens only if the first chracter we're asking to draw can't be drawn with the given font and we need to find a new one --- poppler/Annot.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index c8f029f8d..b4c4a7710 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -3067,7 +3067,9 @@ class HorizontalTextLayouter } // layoutText will always at least layout one character even if it doesn't fit in // the given space which makes sense (except in the case of switching fonts, so we control if we ran out of space here manually) - if (!availableWidth || *availableWidth > 0) { + // we also need to allow the character if we have not layouted anything yet because otherwise we will end up in an infinite loop + // because it is assumed we at least layout one character + if (!availableWidth || *availableWidth > 0 || (isUnicode && i == 2) || (!isUnicode && i == 0)) { i += isUnicode ? 2 : 1; data.emplace_back(outputText.toStr(), auxFontName, blockWidth, charCount); } From f1c69969e031687e6d991677dda021a2a4db48e3 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 29 Dec 2023 17:29:56 +0100 Subject: [PATCH 11/11] Fix infinite loop in HorizontalTextLayouter if there's not enough space to layout text #2 Happens only if the first chracter we're asking to draw can't be drawn with the given font and we need to find a new one and the given available space is negative (as said this function must always layout at least one character) --- poppler/Annot.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index b4c4a7710..e8db39ff3 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -3036,7 +3036,7 @@ class HorizontalTextLayouter *availableWidth -= blockWidth; } - while (newFontNeeded && (!availableWidth || *availableWidth > 0)) { + while (newFontNeeded && (!availableWidth || *availableWidth > 0 || (isUnicode && i == 2) || (!isUnicode && i == 0))) { if (!form) { // There's no fonts to look for, so just skip the characters i += isUnicode ? 2 : 1;