[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - 18 commits - configure.ac download.lst external/pdfium external/redland include/vcl RepositoryExternal.mk shell/source solenv/flatpak-manifest.in vcl/CppunitTest_vcl_filter_ipdf.mk vcl/Module_vcl.mk vcl/qa vcl/source xmlsecurity/inc xmlsecurity/qa xmlsecurity/source xmlsecurity/workben

Thorsten Behrens (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 3 01:21:25 UTC 2020


Rebased ref, commits from common ancestor:
commit 5b7a7b6f41acfd2378e19b3e2f8d23053f2fd9d6
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Wed Dec 2 11:40:53 2020 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:17 2020 +0100

    Bump version to 6.1.7.20
    
    Change-Id: I6d03755f4203d2ae71bc7c55ddb76038a04a7c89

diff --git a/configure.ac b/configure.ac
index e519d688b62a..1906280e583b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
 
-AC_INIT([LibreOffice powered by CIB],[6.1.7.19],[],[],[https://libreoffice.cib.eu/])
+AC_INIT([LibreOffice powered by CIB],[6.1.7.20],[],[],[https://libreoffice.cib.eu/])
 
 AC_PREREQ([2.59])
 
commit 363997c76749219b900f47043d1b17ba8ec9bccd
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Nov 4 21:39:04 2020 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:17 2020 +0100

    xmlsecurity: reject a few dangerous annotation types during pdf sig verify
    
    (cherry picked from commit f231dacde9df1c4aa5f4e0970535c4f4093364a7)
    
    Conflicts:
            xmlsecurity/source/helper/pdfsignaturehelper.cxx
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105926
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit fcab45e0e22f4cf46e71856dba7ae5abd6f99bc5)
    
    Change-Id: I950b49a6e7181639daf27348ddfa0f36586baa65

diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index 783b9a6da8b4..027e4939fab1 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -59,6 +59,8 @@ public:
             FPDF_ClosePage(mpPage);
     }
 
+    FPDF_PAGE getPointer() { return mpPage; }
+
     /// Get bitmap checksum of the page, without annotations/commenting.
     BitmapChecksum getChecksum(int nMDPPerm);
 };
diff --git a/xmlsecurity/qa/unit/pdfsigning/data/bad-cert-p3-stamp.pdf b/xmlsecurity/qa/unit/pdfsigning/data/bad-cert-p3-stamp.pdf
new file mode 100644
index 000000000000..b30f5b03867c
Binary files /dev/null and b/xmlsecurity/qa/unit/pdfsigning/data/bad-cert-p3-stamp.pdf differ
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index b5a6d5914833..63990fb36225 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -76,6 +76,7 @@ public:
     /// Test a valid signature that does not cover the whole file.
     void testPartial();
     void testBadCertP1();
+    void testBadCertP3Stamp();
     void testPartialInBetween();
     /// Test writing a PAdES signature.
     void testSigningCertificateAttribute();
@@ -99,6 +100,7 @@ public:
     CPPUNIT_TEST(testPDFPAdESGood);
     CPPUNIT_TEST(testPartial);
     CPPUNIT_TEST(testBadCertP1);
+    CPPUNIT_TEST(testBadCertP3Stamp);
     CPPUNIT_TEST(testPartialInBetween);
     CPPUNIT_TEST(testSigningCertificateAttribute);
     CPPUNIT_TEST(testGood);
@@ -455,6 +457,22 @@ void PDFSigningTest::testBadCertP1()
                          rInformation.nStatus);
 }
 
+void PDFSigningTest::testBadCertP3Stamp()
+{
+    std::vector<SignatureInformation> aInfos
+        = verify(m_directories.getURLFromSrc(DATA_DIRECTORY) + "bad-cert-p3-stamp.pdf", 1,
+                 /*rExpectedSubFilter=*/OString());
+    CPPUNIT_ASSERT(!aInfos.empty());
+    SignatureInformation& rInformation = aInfos[0];
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 0 (SecurityOperationStatus_UNKNOWN)
+    // - Actual  : 1 (SecurityOperationStatus_OPERATION_SUCCEEDED)
+    // i.e. adding a stamp annotation was not considered as a bad modification.
+    CPPUNIT_ASSERT_EQUAL(xml::crypto::SecurityOperationStatus::SecurityOperationStatus_UNKNOWN,
+                         rInformation.nStatus);
+}
+
 /// Test writing a PAdES signature.
 void PDFSigningTest::testSigningCertificateAttribute()
 {
diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx
index 9d056de0a15c..51eac91495a7 100644
--- a/xmlsecurity/source/pdfio/pdfdocument.cxx
+++ b/xmlsecurity/source/pdfio/pdfdocument.cxx
@@ -24,6 +24,11 @@
 #include <svl/cryptosign.hxx>
 #include <vcl/filter/pdfdocument.hxx>
 #include <vcl/bitmap.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+
+#if HAVE_FEATURE_PDFIUM
+#include <fpdf_annot.h>
+#endif
 
 using namespace com::sun::star;
 
@@ -138,8 +143,29 @@ bool IsCompleteSignature(SvStream& rStream, vcl::filter::PDFDocument& rDocument,
     return std::find(rAllEOFs.begin(), rAllEOFs.end(), nFileEnd) != rAllEOFs.end();
 }
 
+/**
+ * Contains checksums of a PDF page, which is rendered without annotations. It also contains
+ * the geometry of a few dangerous annotation types.
+ */
+struct PageChecksum
+{
+    BitmapChecksum m_nPageContent;
+    std::vector<basegfx::B2DRectangle> m_aAnnotations;
+    bool operator==(const PageChecksum& rChecksum) const;
+};
+
+bool PageChecksum::operator==(const PageChecksum& rChecksum) const
+{
+    if (m_nPageContent != rChecksum.m_nPageContent)
+    {
+        return false;
+    }
+
+    return m_aAnnotations == rChecksum.m_aAnnotations;
+}
+
 /// Collects the checksum of each page of one version of the PDF.
-void AnalyizeSignatureStream(SvMemoryStream& rStream, std::vector<BitmapChecksum>& rPageChecksums,
+void AnalyizeSignatureStream(SvMemoryStream& rStream, std::vector<PageChecksum>& rPageChecksums,
                              int nMDPPerm)
 {
 #if HAVE_FEATURE_PDFIUM
@@ -156,8 +182,35 @@ void AnalyizeSignatureStream(SvMemoryStream& rStream, std::vector<BitmapChecksum
             return;
         }
 
-        BitmapChecksum nPageChecksum = pPdfPage->getChecksum(nMDPPerm);
-        rPageChecksums.push_back(nPageChecksum);
+        PageChecksum aPageChecksum;
+        aPageChecksum.m_nPageContent = pPdfPage->getChecksum(nMDPPerm);
+        for (int i = 0; i < FPDFPage_GetAnnotCount(pPdfPage->getPointer()); ++i)
+        {
+            FPDF_ANNOTATION pAnnotation = FPDFPage_GetAnnot(pPdfPage->getPointer(), i);
+            int nType = FPDFAnnot_GetSubtype(pAnnotation);
+            switch (nType)
+            {
+                case FPDF_ANNOT_UNKNOWN:
+                case FPDF_ANNOT_FREETEXT:
+                case FPDF_ANNOT_STAMP:
+                case FPDF_ANNOT_REDACT:
+                {
+                    basegfx::B2DRectangle aB2DRectangle;
+                    FS_RECTF aRect;
+                    if (FPDFAnnot_GetRect(pAnnotation, &aRect))
+                    {
+                        aB2DRectangle = basegfx::B2DRectangle(aRect.left, aRect.top, aRect.right,
+                                                              aRect.bottom);
+                    }
+                    aPageChecksum.m_aAnnotations.push_back(aB2DRectangle);
+                    break;
+                }
+                default:
+                    break;
+            }
+            FPDFPage_CloseAnnot(pAnnotation);
+        }
+        rPageChecksums.push_back(aPageChecksum);
     }
 #else
     (void)rStream;
@@ -182,7 +235,7 @@ bool IsValidSignature(SvStream& rStream, vcl::filter::PDFObjectElement* pSignatu
     aSignatureStream.WriteStream(rStream, nSignatureEOF);
     rStream.Seek(nPos);
     aSignatureStream.Seek(0);
-    std::vector<BitmapChecksum> aSignedPages;
+    std::vector<PageChecksum> aSignedPages;
     AnalyizeSignatureStream(aSignatureStream, aSignedPages, nMDPPerm);
 
     SvMemoryStream aFullStream;
@@ -191,7 +244,7 @@ bool IsValidSignature(SvStream& rStream, vcl::filter::PDFObjectElement* pSignatu
     aFullStream.WriteStream(rStream);
     rStream.Seek(nPos);
     aFullStream.Seek(0);
-    std::vector<BitmapChecksum> aAllPages;
+    std::vector<PageChecksum> aAllPages;
     AnalyizeSignatureStream(aFullStream, aAllPages, nMDPPerm);
 
     // Fail if any page looks different after signing and at the end. Annotations/commenting doesn't
commit 7901b1d6883a4b884b122ac686bb08cd4747e174
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jul 21 21:25:26 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:17 2020 +0100

    external: update pdfium to handle redact annotations
    
    external: update pdfium to 4203
    
    (cherry picked from commit 4488be8a9279be0bd0aebd476589a49d2b95da6e)
    
    Update one mention of pdfium-4137.tar.bz2
    
    ...left behind by 4488be8a9279be0bd0aebd476589a49d2b95da6e "external: update
    pdfium to 4203"
    
    (cherry picked from commit ba4b3d5f7a0fe8d0d985e98897e041d59093d8b0)
    
    external: update pdfium to 4260
    
    (cherry picked from commit f19381e46930bb496e7331754843920933fb4be2)
    
    external: update pdfium to 4306
    
    (cherry picked from commit fe531957e3dcd42927cf15ab31d04473433d81f9)
    
    Conflicts:
            include/vcl/pdf/PDFAnnotationSubType.hxx
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105913
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit b4f50e78e9cd391964128bd0d1446d4dca110cef)
    
    Change-Id: Ic10cf99fa412f8f0b3475e82d0a1839a7f04bd08

diff --git a/download.lst b/download.lst
index ef405de2e75b..0844f34a0a46 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 9a2f9bddca935a263f06c81003483473a525ccd0f4e517bc75fceb914d4c54b6
-export PDFIUM_TARBALL := pdfium-4137.tar.bz2
+export PDFIUM_SHA256SUM := eca406d47ac7e2a84dcc86f93c08f96e591d409589e881477fa75e488e4851d8
+export PDFIUM_TARBALL := pdfium-4306.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 4f2ab40a3baf..3b37143c4599 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pauseadapter \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_renderpage \
+    UnpackedTarball/pdfium/fpdfsdk/fpdf_signature \
 ))
 
 # fdrm
@@ -102,6 +103,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_textfield \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_button \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_textobject \
+    UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_privatedata \
 ))
 
 # fpdfapi
@@ -249,6 +251,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3cache \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphmap \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendershading \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendertiling \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_creator \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_encryptor \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_flateencoder \
@@ -351,20 +354,19 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_TrdProc \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gif \
-    UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gifcontext \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_lzwdecompressor \
     UnpackedTarball/pdfium/core/fxcodec/cfx_codec_memory \
     UnpackedTarball/pdfium/core/fxcodec/fax/faxmodule \
     UnpackedTarball/pdfium/core/fxcodec/scanlinedecoder \
-    UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2module \
     UnpackedTarball/pdfium/core/fxcodec/jpeg/jpegmodule \
     UnpackedTarball/pdfium/core/fxcodec/jpx/cjpx_decoder \
     UnpackedTarball/pdfium/core/fxcodec/jpx/jpx_decode_utils \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_DocumentContext \
     UnpackedTarball/pdfium/core/fxcodec/basic/basicmodule \
-    UnpackedTarball/pdfium/core/fxcodec/jpx/jpxmodule \
     UnpackedTarball/pdfium/core/fxcodec/flate/flatemodule \
     UnpackedTarball/pdfium/core/fxcodec/icc/iccmodule \
+    UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2_decoder \
+    UnpackedTarball/pdfium/core/fxcodec/jpeg/jpeg_common \
 ))
 
 # fxcrt
@@ -434,7 +436,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagetransformer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_scanlinecompositor \
     UnpackedTarball/pdfium/core/fxge/dib/cstretchengine \
-    UnpackedTarball/pdfium/core/fxge/dib/fx_dib_main \
+    UnpackedTarball/pdfium/core/fxge/dib/fx_dib \
     UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitDingbats \
     UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitFixed \
     UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitFixedBold \
@@ -469,8 +471,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/cfx_renderdevice \
     UnpackedTarball/pdfium/core/fxge/cfx_substfont \
     UnpackedTarball/pdfium/core/fxge/cfx_unicodeencoding \
-    UnpackedTarball/pdfium/core/fxge/fx_ge_fontmap \
-    UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
     UnpackedTarball/pdfium/core/fxge/cfx_glyphbitmap \
     UnpackedTarball/pdfium/core/fxge/scoped_font_transform \
     UnpackedTarball/pdfium/core/fxge/text_glyph_pos \
@@ -499,7 +499,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit_impl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_icon \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_box \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_impl \
+    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_cbbutton \
+    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_cblistbox \
+    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_ctrl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_scroll_bar \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_special_button \
     UnpackedTarball/pdfium/core/fxcrt/cfx_timer \
@@ -547,6 +549,10 @@ $(eval $(call gb_Library_add_generated_cobjects,pdfium,\
     UnpackedTarball/pdfium/third_party/libopenjpeg20/sparse_array \
 ))
 
+$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
+    UnpackedTarball/pdfium/third_party/libopenjpeg20/opj_malloc \
+))
+
 # pdfium_base
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization \
@@ -560,6 +566,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_page \
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_root_base \
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/random \
+    UnpackedTarball/pdfium/third_party/base/memory/aligned_memory \
 ))
 
 # skia_shared
@@ -632,10 +639,14 @@ ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/win32/cfx_psrenderer \
     UnpackedTarball/pdfium/core/fxge/win32/cpsoutput \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_device \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_dib \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_gdipext \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_print \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_device_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_display_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_plus_ext \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_printer_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cps_printer_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/ctext_only_printer_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cwin32_platform \
+    UnpackedTarball/pdfium/core/fxge/cfx_windowsrenderdevice \
     UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \
     UnpackedTarball/pdfium/third_party/base/win/win_util \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_windowsrenderdevice \
@@ -676,4 +687,11 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
 ))
 endif
 
+ifeq ($(OS),LINUX)
+# fxge
+$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
+    UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 93d3fede6e3c..f4643376cee0 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -45,7 +45,9 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/partition_page.cc third_party/base/allocator/partition_allocator/partition_page.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_root_base.cc third_party/base/allocator/partition_allocator/partition_root_base.cpp && \
     mv third_party/base/allocator/partition_allocator/random.cc third_party/base/allocator/partition_allocator/random.cpp && \
-    mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp \
+    mv third_party/base/memory/aligned_memory.cc third_party/base/memory/aligned_memory.cpp && \
+    mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \
+    mv third_party/libopenjpeg20/opj_malloc.cc third_party/libopenjpeg20/opj_malloc.cpp \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 16544f0c7c81..7cf1021938f5 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -37,3 +37,14 @@ index 0fb627ba8..dda1fc8bc 100644
        : span(container.data(), container.size()) {}
    template <
        typename Container,
+--- a/core/fxcodec/jpx/cjpx_decoder.cpp
++++ b/core/fxcodec/jpx/cjpx_decoder.cpp
+@@ -70,7 +70,7 @@ Optional<OpjImageRgbData> alloc_rgb(size_t size) {
+   if (!data.b)
+     return {};
+ 
+-  return data;
++  return std::move(data);
+ }
+ 
+ void sycc_to_rgb(int offset,
diff --git a/external/pdfium/configs/build_config.h b/external/pdfium/configs/build_config.h
index edd70af53034..ec93c278767c 100644
--- a/external/pdfium/configs/build_config.h
+++ b/external/pdfium/configs/build_config.h
@@ -6,7 +6,7 @@
 
 // This file adds defines about the platform we're currently building on.
 //  Operating System:
-//    OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
+//    OS_WIN / OS_APPLE / OS_LINUX / OS_POSIX (MACOSX or LINUX)
 //  Compiler:
 //    COMPILER_MSVC / COMPILER_GCC
 //  Processor:
@@ -21,7 +21,7 @@
 #define OS_ANDROID 1
 #define OS_LINUX 1
 #elif defined(__APPLE__)
-#define OS_MACOSX 1
+#define OS_APPLE 1
 #elif defined(__linux__)
 #define OS_LINUX 1
 #elif defined(__DragonFly__)
@@ -48,7 +48,7 @@
 
 // For access to standard POSIX features, use OS_POSIX instead of a more
 // specific macro.
-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
 #define OS_POSIX 1
 #endif
 
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 95d49fb6a85c..8fb2efc649cc 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -93,10 +93,10 @@
                     "type": "shell"
                 },
                 {
-                    "url": "https://dev-www.libreoffice.org/src/pdfium-4137.tar.bz2",
-                    "sha256": "9a2f9bddca935a263f06c81003483473a525ccd0f4e517bc75fceb914d4c54b6",
+                    "url": "https://dev-www.libreoffice.org/src/pdfium-4306.tar.bz2",
+                    "sha256": "eca406d47ac7e2a84dcc86f93c08f96e591d409589e881477fa75e488e4851d8",
                     "type": "file",
-                    "dest-filename": "external/tarballs/pdfium-4137.tar.bz2"
+                    "dest-filename": "external/tarballs/pdfium-4306.tar.bz2"
                 },
                 {
                     "url": "https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz",
commit 1aace83d38794ce08e0c4b1609b70fb579f9dcec
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jan 14 21:34:52 2020 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:17 2020 +0100

    external: update pdfium from 3963 to 4137
    
    This is a combination of 6 commits, which brings pdfium to the same
    version as libreoffice-7-0.
    
    This is the 1st commit message:
    
    external: update pdfium to 4021
    
    (cherry picked from commit 1cb70721ba00dd6c6958f0a10e39aa5c1866ec96)
    
    This is the commit message #2:
    
    external/pdfium: C++20 comparison operator fix
    
    Missing const leads to overload resolution ambiguity when a synthesized
    candidate of operator == for a reversed-argument rewrite conflicts with the
    actual operator ==, due to the asymmetric const-ness of the implicit object
    parameter and the RHS parameter:
    
    > In file included from workdir/UnpackedTarball/pdfium/core/fxge/cfx_font.cpp:7:
    > In file included from workdir/UnpackedTarball/pdfium/core/fxge/cfx_font.h:11:
    > llvm/inst/include/c++/v1/vector:1369:27: error: use of overloaded operator '!=' is ambiguous (with operand types 'std::__1::__vector_base<unsigned char, FxAllocAllocator<unsigned char> >::allocator_type' (aka 'FxAllocAllocator<unsigned char>') and 'std::__1::__vector_base<unsigned char, FxAllocAllocator<unsigned char> >::allocator_type')
    >     if (__base::__alloc() != __c.__alloc())
    >         ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
    > llvm/inst/include/c++/v1/vector:1359:5: note: in instantiation of member function 'std::__1::vector<unsigned char, FxAllocAllocator<unsigned char> >::__move_assign' requested here
    >     __move_assign(__x, integral_constant<bool,
    >     ^
    > workdir/UnpackedTarball/pdfium/core/fxge/cfx_font.cpp:384:24: note: in instantiation of member function 'std::__1::vector<unsigned char, FxAllocAllocator<unsigned char> >::operator=' requested here
    >   m_FontDataAllocation = std::vector<uint8_t, FxAllocAllocator<uint8_t>>(
    >                        ^
    > workdir/UnpackedTarball/pdfium/core/fxcrt/fx_memory_wrappers.h:74:8: note: candidate function
    >   bool operator!=(const FxAllocAllocator& that) { return false; }
    >        ^
    > workdir/UnpackedTarball/pdfium/core/fxcrt/fx_memory_wrappers.h:73:8: note: candidate function
    >   bool operator==(const FxAllocAllocator& that) { return true; }
    >        ^
    > workdir/UnpackedTarball/pdfium/core/fxcrt/fx_memory_wrappers.h:73:8: note: candidate function (with reversed parameter order)
    
    (cherry picked from commit 6e0461d576d9f386e458f98f3c57f0ba385aacb4)
    
    This is the commit message #3:
    
    pdfium: don't patch out the COMPONENT_BUILD check, define it
    
    So next time we update, no need to adapt a failing patch.
    
    (cherry picked from commit 9b4ab9bda41a818832c721933986c9c6e07a6e6c)
    
    This is the commit message #4:
    
    make update_pch also consider files in <module>/src/**/inc
    
    With --enable-pch=full there's not much difference between a "public"
    header in <module>/inc and a private one in <module>/src/somewhere/inc .
    And since the script searches recursively, this apparently helps to
    find even more headers for lower pch levels.
    
    [ Just the pdfium part. ]
    
    (cherry picked from commit 69e0d871ec1de2260f9213d3113464155eac173c)
    
    This is the commit message #5:
    
    external: update pdfium to 4083
    
    (cherry picked from commit 9054c36d4ea3bee25fb9a47a96a0ea2cd07148c3)
    
    This is the commit message #6:
    
    external: update pdfium to 4137
    
    (cherry picked from commit 1ffe59ef31186e36ad0aa7bbcdd32e407ee8d26c)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102373
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 434d611e22c4fe76a11d2de26b9f185bb04e5ad3)
    
    Change-Id: I8483d0aa5b4fea5a59107c20a8aa5f1ef694af0a
    b7c12461e04fa97bf55ee967e8d6c9bcf92fdf4a

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 7e629a89cb34..5adfeac29007 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4210,6 +4210,7 @@ ifneq ($(ENABLE_PDFIUM),)
 define gb_LinkTarget__use_pdfium
 $(call gb_LinkTarget_set_include,$(1),\
        -I$(call gb_UnpackedTarball_get_dir,pdfium)/public \
+       -DCOMPONENT_BUILD \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_libraries,$(1),pdfium)
diff --git a/download.lst b/download.lst
index 342fe2c058a4..ef405de2e75b 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 80d4d6bd8faec226936fcde5521c6e92c0c645126ac3ae72dd2c160ca1749895
-export PDFIUM_TARBALL := pdfium-3963.tar.bz2
+export PDFIUM_SHA256SUM := 9a2f9bddca935a263f06c81003483473a525ccd0f4e517bc75fceb914d4c54b6
+export PDFIUM_TARBALL := pdfium-4137.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index f1d1606c494b..4f2ab40a3baf 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_Library_add_defs,pdfium,\
     -DMEMORY_TOOL_REPLACES_ALLOCATOR \
     -DUNICODE \
     -DWIN32_LEAN_AND_MEAN \
+    -DCOMPONENT_BUILD \
 ))
 
 # Don't show warnings upstream doesn't care about.
@@ -79,6 +80,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_view \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pauseadapter \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_renderpage \
 ))
 
 # fdrm
@@ -231,7 +233,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/fpdf_parser_utility \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_walker \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_read_validator \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_charposlist \
+    UnpackedTarball/pdfium/core/fpdfapi/render/charposlist \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagecacheentry \
@@ -272,7 +274,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_avail \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentmanager \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transparency \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_dibbase \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_dib \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_stream \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_table \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_stringarchivestream \
@@ -280,7 +282,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_contentstream_write_utils \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_annotcontext \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercontext \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_dibtransferfunc \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfuncdib \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfunc \
 ))
 
@@ -289,7 +291,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cline \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_aaction \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_action \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_actionfields \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_annot \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_annotlist \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_apsettings \
@@ -297,7 +298,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_bookmarktree \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_defaultappearance \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_dest \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_docjsactions \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_filespec \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formcontrol \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formfield \
@@ -320,6 +320,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_structtree \
     UnpackedTarball/pdfium/core/fpdfdoc/cba_fontmap \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_color_utils \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_icon \
 ))
 
 # fpdftext
@@ -418,6 +419,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/cfx_utf8encoder \
     UnpackedTarball/pdfium/core/fxcrt/cfx_readonlymemorystream \
     UnpackedTarball/pdfium/core/fxcrt/observed_ptr \
+    UnpackedTarball/pdfium/core/fxcrt/string_data_template \
 ))
 
 # fxge
@@ -426,7 +428,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapstorer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibextractor \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibitmap \
-    UnpackedTarball/pdfium/core/fxge/dib/cfx_filtereddib \
+    UnpackedTarball/pdfium/core/fxge/cfx_drawutils \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagerenderer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagestretcher \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagetransformer \
@@ -557,6 +559,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_oom \
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_page \
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_root_base \
+    UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/random \
 ))
 
 # skia_shared
@@ -651,7 +654,7 @@ ifeq ($(OS),MACOSX)
 # fxge
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/apple/fx_apple_platform \
-    UnpackedTarball/pdfium/core/fxge/apple/fx_mac_imp \
+    UnpackedTarball/pdfium/core/fxge/apple/fx_mac_impl \
     UnpackedTarball/pdfium/core/fxge/apple/fx_quartz_device \
 ))
 
@@ -668,7 +671,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafont \
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafontmgr \
     UnpackedTarball/pdfium/core/fxge/android/cfx_androidfontinfo \
-    UnpackedTarball/pdfium/core/fxge/android/fx_android_imp \
+    UnpackedTarball/pdfium/core/fxge/android/fx_android_impl \
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiapathfont \
 ))
 endif
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 8f493ea3a0d6..93d3fede6e3c 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -8,12 +8,12 @@
 #
 
 pdfium_patches :=
-pdfium_patches += visibility.patch.1
 pdfium_patches += ubsan.patch
 # Fixes build on our baseline.
 pdfium_patches += build.patch.1
 # Avoids Windows 8 build dependency.
 pdfium_patches += windows7.patch.1
+pdfium_patches += c++20-comparison.patch
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
@@ -44,6 +44,7 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/partition_oom.cc third_party/base/allocator/partition_allocator/partition_oom.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_page.cc third_party/base/allocator/partition_allocator/partition_page.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_root_base.cc third_party/base/allocator/partition_allocator/partition_root_base.cpp && \
+    mv third_party/base/allocator/partition_allocator/random.cc third_party/base/allocator/partition_allocator/random.cpp && \
     mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp \
 ))
 
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 47316fe235a1..16544f0c7c81 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -1,24 +1,3 @@
-diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp
-index 8e01127b0..f4ce4d915 100644
---- a/core/fxge/dib/cfx_imagetransformer.cpp
-+++ b/core/fxge/dib/cfx_imagetransformer.cpp
-@@ -315,14 +315,14 @@ bool CFX_ImageTransformer::Continue(IFX_PauseIndicator* pPause) {
-   } else if (pDestMask) {
-     CalcData cdata = {
-         pDestMask.Get(), result2stretch, pSrcMaskBuf,
--        m_Storer.GetBitmap()->m_pAlphaMask->GetPitch(),
-+        static_cast<uint32_t>(m_Storer.GetBitmap()->m_pAlphaMask->GetPitch()),
-     };
-     CalcMask(cdata);
-   }
- 
-   CalcData cdata = {pTransformed.Get(), result2stretch,
-                     m_Storer.GetBitmap()->GetBuffer(),
--                    m_Storer.GetBitmap()->GetPitch()};
-+                    static_cast<uint32_t>(m_Storer.GetBitmap()->GetPitch())};
-   if (m_Storer.GetBitmap()->IsAlphaMask()) {
-     CalcAlpha(cdata);
-   } else {
 diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
 index 323de4ffc..f11a0b0ad 100644
 --- a/core/fpdfdoc/cpdf_metadata.cpp
diff --git a/external/pdfium/c++20-comparison.patch b/external/pdfium/c++20-comparison.patch
new file mode 100644
index 000000000000..025f9ba010db
--- /dev/null
+++ b/external/pdfium/c++20-comparison.patch
@@ -0,0 +1,13 @@
+--- core/fxcrt/fx_memory_wrappers.h
++++ core/fxcrt/fx_memory_wrappers.h
+@@ -70,8 +70,8 @@
+   }
+ 
+   // There's no state, so they are all the same,
+-  bool operator==(const FxAllocAllocator& that) { return true; }
+-  bool operator!=(const FxAllocAllocator& that) { return false; }
++  bool operator==(const FxAllocAllocator& that) const { return true; }
++  bool operator!=(const FxAllocAllocator& that) const { return false; }
+ };
+ 
+ #endif  // CORE_FXCRT_FX_MEMORY_WRAPPERS_H_
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index 1d03c28a4d15..8610e24f2828 100644
--- a/external/pdfium/ubsan.patch
+++ b/external/pdfium/ubsan.patch
@@ -1,14 +1,14 @@
---- core/fxcrt/string_data_template.h
-+++ core/fxcrt/string_data_template.h
-@@ -76,7 +76,8 @@ class StringDataTemplate {
-     ASSERT(nLen >= 0);
-     ASSERT(offset + nLen <= m_nAllocLength);
+--- core/fxcrt/string_data_template.cpp
++++ core/fxcrt/string_data_template.cpp
+@@ -82,7 +82,8 @@ void StringDataTemplate<CharType>::CopyContentsAt(size_t offset,
+   ASSERT(nLen >= 0);
+   ASSERT(offset + nLen <= m_nAllocLength);
  
--    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
-+    if (nLen != 0)
-+      memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
-     m_String[offset + nLen] = 0;
-   }
+-  memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
++  if (nLen != 0)
++    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
+   m_String[offset + nLen] = 0;
+ }
  
 --- core/fxge/cfx_glyphcache.cpp
 +++ core/fxge/cfx_glyphcache.cpp
diff --git a/external/pdfium/visibility.patch.1 b/external/pdfium/visibility.patch.1
deleted file mode 100644
index 835528794f4b..000000000000
--- a/external/pdfium/visibility.patch.1
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/public/fpdfview.h b/public/fpdfview.h
-index 2b84f07ba..b6c0a356b 100644
---- a/public/fpdfview.h
-+++ b/public/fpdfview.h
-@@ -168,7 +168,6 @@ typedef int FPDF_OBJECT_TYPE;
- // Text object enums.
- typedef int FPDF_TEXT_RENDERMODE;
- 
--#if defined(COMPONENT_BUILD)
- // FPDF_EXPORT should be consistent with |export| in the pdfium_fuzzer
- // template in testing/fuzzers/BUILD.gn.
- #if defined(WIN32)
-@@ -184,9 +183,6 @@ typedef int FPDF_TEXT_RENDERMODE;
- #define FPDF_EXPORT
- #endif  // defined(FPDF_IMPLEMENTATION)
- #endif  // defined(WIN32)
--#else
--#define FPDF_EXPORT
--#endif  // defined(COMPONENT_BUILD)
- 
- #if defined(WIN32) && defined(FPDFSDK_EXPORTS)
- #define FPDF_CALLCONV __stdcall
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 34b8a5f90bf9..95d49fb6a85c 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -93,10 +93,10 @@
                     "type": "shell"
                 },
                 {
-                    "url": "https://dev-www.libreoffice.org/src/pdfium-3963.tar.bz2",
-                    "sha256": "80d4d6bd8faec226936fcde5521c6e92c0c645126ac3ae72dd2c160ca1749895",
+                    "url": "https://dev-www.libreoffice.org/src/pdfium-4137.tar.bz2",
+                    "sha256": "9a2f9bddca935a263f06c81003483473a525ccd0f4e517bc75fceb914d4c54b6",
                     "type": "file",
-                    "dest-filename": "external/tarballs/pdfium-3963.tar.bz2"
+                    "dest-filename": "external/tarballs/pdfium-4137.tar.bz2"
                 },
                 {
                     "url": "https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz",
commit 242c37d43347eb4be3dc9f76d17104b8ec60356f
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Nov 12 21:21:21 2019 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:17 2020 +0100

    external: update pdfium to 3963
    
    Also simplify visibility.patch.1.
    
    Reviewed-on: https://gerrit.libreoffice.org/82548
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 71cb2705af38df7f382014fb68f43bed98abf9b4)
    
    Change-Id: I8b4ed78b314a1a1f7d31467f782877f056429cc2

diff --git a/download.lst b/download.lst
index 03e455c98463..342fe2c058a4 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 7b08c4239e6eec685d9bfc99a041ba5df68d11fcd039ba908b91c9af90f941b1
-export PDFIUM_TARBALL := pdfium-3896.tar.bz2
+export PDFIUM_SHA256SUM := 80d4d6bd8faec226936fcde5521c6e92c0c645126ac3ae72dd2c160ca1749895
+export PDFIUM_TARBALL := pdfium-3963.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 71f3e61e9421..f1d1606c494b 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -20,7 +20,7 @@ $(eval $(call gb_Library_set_include,pdfium,\
 ))
 
 $(eval $(call gb_Library_add_defs,pdfium,\
-    -DPDFIUM_DLLIMPLEMENTATION \
+    -DFPDF_IMPLEMENTATION \
     -DUSE_SYSTEM_LCMS2 \
     -DUSE_SYSTEM_LIBJPEG \
     -DUSE_SYSTEM_ZLIB \
@@ -246,6 +246,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_textrenderer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3cache \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphmap \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendershading \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_creator \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_encryptor \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_flateencoder \
@@ -640,6 +641,10 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
 $(eval $(call gb_Library_use_system_win32_libs,pdfium,\
     gdi32 \
 ))
+
+$(eval $(call gb_Library_add_defs,pdfium,\
+    -DWIN32 \
+))
 endif
 
 ifeq ($(OS),MACOSX)
diff --git a/external/pdfium/visibility.patch.1 b/external/pdfium/visibility.patch.1
index 9983723b2055..835528794f4b 100644
--- a/external/pdfium/visibility.patch.1
+++ b/external/pdfium/visibility.patch.1
@@ -1,45 +1,22 @@
 diff --git a/public/fpdfview.h b/public/fpdfview.h
-index f5212599f..57d6cda13 100644
+index 2b84f07ba..b6c0a356b 100644
 --- a/public/fpdfview.h
 +++ b/public/fpdfview.h
-@@ -154,31 +154,20 @@ typedef int FPDF_ANNOT_APPEARANCEMODE;
- // Dictionary value types.
- typedef int FPDF_OBJECT_TYPE;
+@@ -168,7 +168,6 @@ typedef int FPDF_OBJECT_TYPE;
+ // Text object enums.
+ typedef int FPDF_TEXT_RENDERMODE;
  
 -#if defined(COMPONENT_BUILD)
--// FPDF_EXPORT should be consistent with |export| in the pdfium_fuzzer
--// template in testing/fuzzers/BUILD.gn.
--#if defined(WIN32)
--#if defined(FPDF_IMPLEMENTATION)
-+#if defined(PDFIUM_DLLIMPLEMENTATION)
-+#ifdef _WIN32
- #define FPDF_EXPORT __declspec(dllexport)
- #else
--#define FPDF_EXPORT __declspec(dllimport)
--#endif  // defined(FPDF_IMPLEMENTATION)
+ // FPDF_EXPORT should be consistent with |export| in the pdfium_fuzzer
+ // template in testing/fuzzers/BUILD.gn.
+ #if defined(WIN32)
+@@ -184,9 +183,6 @@ typedef int FPDF_TEXT_RENDERMODE;
+ #define FPDF_EXPORT
+ #endif  // defined(FPDF_IMPLEMENTATION)
+ #endif  // defined(WIN32)
 -#else
--#if defined(FPDF_IMPLEMENTATION)
--#define FPDF_EXPORT __attribute__((visibility("default")))
--#else
--#define FPDF_EXPORT
--#endif  // defined(FPDF_IMPLEMENTATION)
--#endif  // defined(WIN32)
-+#define FPDF_EXPORT __attribute__ ((visibility("default")))
-+#endif
- #else
 -#define FPDF_EXPORT
 -#endif  // defined(COMPONENT_BUILD)
--
--#if defined(WIN32) && defined(FPDFSDK_EXPORTS)
--#define FPDF_CALLCONV __stdcall
-+#ifdef _WIN32
-+#define FPDF_EXPORT __declspec(dllimport)
- #else
--#define FPDF_CALLCONV
-+#define FPDF_EXPORT __attribute__ ((visibility("default")))
- #endif
-+#endif
-+#define FPDF_CALLCONV
  
- // Exported Functions
- #ifdef __cplusplus
+ #if defined(WIN32) && defined(FPDFSDK_EXPORTS)
+ #define FPDF_CALLCONV __stdcall
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 01cdc0704adc..34b8a5f90bf9 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -93,10 +93,10 @@
                     "type": "shell"
                 },
                 {
-                    "url": "https://dev-www.libreoffice.org/src/pdfium-3896.tar.bz2",
-                    "sha256": "7b08c4239e6eec685d9bfc99a041ba5df68d11fcd039ba908b91c9af90f941b1",
+                    "url": "https://dev-www.libreoffice.org/src/pdfium-3963.tar.bz2",
+                    "sha256": "80d4d6bd8faec226936fcde5521c6e92c0c645126ac3ae72dd2c160ca1749895",
                     "type": "file",
-                    "dest-filename": "external/tarballs/pdfium-3896.tar.bz2"
+                    "dest-filename": "external/tarballs/pdfium-3963.tar.bz2"
                 },
                 {
                     "url": "https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz",
commit 62c0c1032a42def9c096938a2d1f1b1416de0729
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Sep 10 23:17:35 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:17 2020 +0100

    external: update pdfium to 3896
    
    Reviewed-on: https://gerrit.libreoffice.org/78806
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 735af14843eab3e75ac9ed6f0773ce7bb3241c8a)
    
    Change-Id: I9d47d9afed47e01657b42fbfdb06e7fc91a150c8

diff --git a/download.lst b/download.lst
index f20bdaae4013..03e455c98463 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 43ef702b65a21d66fc580b1b9c77893e33fe07dd764a17c2aac08ecec534c8ad
-export PDFIUM_TARBALL := pdfium-3849.tar.bz2
+export PDFIUM_SHA256SUM := 7b08c4239e6eec685d9bfc99a041ba5df68d11fcd039ba908b91c9af90f941b1
+export PDFIUM_TARBALL := pdfium-3896.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index b07b71d39661..71f3e61e9421 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Library_set_generated_cxx_suffix,pdfium,cpp))
 
 # pdfium
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/cfx_systemhandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annot \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annothandlermgr \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annotiteration \
@@ -78,8 +77,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_save \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_text \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_view \
-    UnpackedTarball/pdfium/fpdfsdk/ipdfsdk_pauseadapter \
-    UnpackedTarball/pdfium/fpdfsdk/cpdf_annotcontext \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pauseadapter \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
 ))
 
@@ -168,8 +166,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/UniKS-UTF16-H_0 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/cmaps_korea1 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/fpdf_cmaps \
-    UnpackedTarball/pdfium/core/fpdfapi/cpdf_modulemgr \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pagerendercontext \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cidfont \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_font \
@@ -237,7 +233,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_read_validator \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_charposlist \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagecacheentry \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imageloader \
@@ -249,9 +244,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_renderstatus \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_textrenderer \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3cache \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphs \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphmap \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_creator \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_encryptor \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_flateencoder \
@@ -277,12 +271,16 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_avail \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentmanager \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transparency \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibbase \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_dibbase \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_stream \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_table \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_stringarchivestream \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_occontext \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_contentstream_write_utils \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_annotcontext \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercontext \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_dibtransferfunc \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfunc \
 ))
 
 # fpdfdoc
@@ -489,7 +487,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
 
 # pwl
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_appstream \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_appstream \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_button \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_caret \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_combo_box \
@@ -501,8 +499,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_impl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_scroll_bar \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_special_button \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_timer \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_timer_handler \
+    UnpackedTarball/pdfium/core/fxcrt/cfx_timer \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_wnd \
 ))
 
@@ -637,6 +634,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/win32/fx_win32_print \
     UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \
     UnpackedTarball/pdfium/third_party/base/win/win_util \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_windowsrenderdevice \
 ))
 
 $(eval $(call gb_Library_use_system_win32_libs,pdfium,\
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 562b2e6198d3..47316fe235a1 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -58,16 +58,3 @@ index 0fb627ba8..dda1fc8bc 100644
        : span(container.data(), container.size()) {}
    template <
        typename Container,
-diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
-index 7f4eb86c0..5e227f86e 100644
---- a/core/fpdfdoc/cpdf_dest.h
-+++ b/core/fpdfdoc/cpdf_dest.h
-@@ -41,7 +41,7 @@
-               float* pZoom) const;
- 
-  private:
--  UnownedPtr<const CPDF_Array> const m_pArray;
-+  UnownedPtr<const CPDF_Array> m_pArray;
- };
- 
- #endif  // CORE_FPDFDOC_CPDF_DEST_H_
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 67b822e2f7e1..01cdc0704adc 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -93,10 +93,10 @@
                     "type": "shell"
                 },
                 {
-                    "url": "https://dev-www.libreoffice.org/src/pdfium-3667.tar.bz2",
-                    "sha256": "012ef554e7a6ec6d794f9ff7e66ff71011cab1b67317b427d9c820c48c141e5e",
+                    "url": "https://dev-www.libreoffice.org/src/pdfium-3896.tar.bz2",
+                    "sha256": "7b08c4239e6eec685d9bfc99a041ba5df68d11fcd039ba908b91c9af90f941b1",
                     "type": "file",
-                    "dest-filename": "external/tarballs/pdfium-3426.tar.bz2"
+                    "dest-filename": "external/tarballs/pdfium-3896.tar.bz2"
                 },
                 {
                     "url": "https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz",
commit 7386e0ca92f2ebb49597d4fe1e1492ffaaef0b97
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jul 16 23:32:31 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:17 2020 +0100

    external: update pdfium to 3849
    
    Reviewed-on: https://gerrit.libreoffice.org/75736
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 0ee0ca3036629b69bf20b448d74991fd133f08ac)
    
    Change-Id: I616f57bd9de72b078500a290bf9ff89c71773f26

diff --git a/download.lst b/download.lst
index 1b67034c336a..f20bdaae4013 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := e3faddcf741336c64ca2e6f72b23e9e60979969b2cf67c878c9a5bc38328cfc4
-export PDFIUM_TARBALL := pdfium-3794.tar.bz2
+export PDFIUM_SHA256SUM := 43ef702b65a21d66fc580b1b9c77893e33fe07dd764a17c2aac08ecec534c8ad
+export PDFIUM_TARBALL := pdfium-3849.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 17417ac5b86e..b07b71d39661 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -92,7 +92,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
 
 # formfiller
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/formfiller/cba_fontmap \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_checkbox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_combobox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_formfiller \
@@ -170,7 +169,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/cmaps_korea1 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/fpdf_cmaps \
     UnpackedTarball/pdfium/core/fpdfapi/cpdf_modulemgr \
-    UnpackedTarball/pdfium/core/fpdfapi/cpdf_pagerendercontext \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pagerendercontext \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cidfont \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_font \
@@ -277,11 +276,13 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_page_object_avail \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_avail \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentmanager \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transparency \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transparency \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibbase \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_stream \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_table \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_stringarchivestream \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_occontext \
+    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_contentstream_write_utils \
 ))
 
 # fpdfdoc
@@ -308,7 +309,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_metadata \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_nametree \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_numbertree \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_occontext \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_pagelabel \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_variabletext \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_viewerpreferences \
@@ -319,6 +319,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/ctypeset \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_structelement \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_structtree \
+    UnpackedTarball/pdfium/core/fpdfdoc/cba_fontmap \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_color_utils \
 ))
 
 # fpdftext
@@ -331,7 +333,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
 
 # fxcodec
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec \
+    UnpackedTarball/pdfium/core/fxcodec/fx_codec \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithIntDecoder \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_BitStream \
@@ -348,18 +350,21 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_Segment \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_TrdProc \
-    UnpackedTarball/pdfium/core/fxcodec/bmp/fx_bmp \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_scanlinedecoder \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gif \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gifcontext \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_lzwdecompressor \
-    UnpackedTarball/pdfium/core/fxcodec/codec/cfx_codec_memory \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_faxmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_iccmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jbig2module \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpxmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpegmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_flatemodule \
+    UnpackedTarball/pdfium/core/fxcodec/cfx_codec_memory \
+    UnpackedTarball/pdfium/core/fxcodec/fax/faxmodule \
+    UnpackedTarball/pdfium/core/fxcodec/scanlinedecoder \
+    UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2module \
+    UnpackedTarball/pdfium/core/fxcodec/jpeg/jpegmodule \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/cjpx_decoder \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/jpx_decode_utils \
+    UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_DocumentContext \
+    UnpackedTarball/pdfium/core/fxcodec/basic/basicmodule \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/jpxmodule \
+    UnpackedTarball/pdfium/core/fxcodec/flate/flatemodule \
+    UnpackedTarball/pdfium/core/fxcodec/icc/iccmodule \
 ))
 
 # fxcrt
@@ -408,12 +413,12 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/fx_random \
     UnpackedTarball/pdfium/core/fxcrt/fx_string \
     UnpackedTarball/pdfium/core/fxcrt/widestring \
-    UnpackedTarball/pdfium/core/fxcrt/cfx_seekablemultistream \
     UnpackedTarball/pdfium/core/fxcrt/css/cfx_cssdata \
     UnpackedTarball/pdfium/core/fxcrt/fx_codepage \
     UnpackedTarball/pdfium/core/fxcrt/fx_number \
     UnpackedTarball/pdfium/core/fxcrt/cfx_utf8encoder \
     UnpackedTarball/pdfium/core/fxcrt/cfx_readonlymemorystream \
+    UnpackedTarball/pdfium/core/fxcrt/observed_ptr \
 ))
 
 # fxge
@@ -450,7 +455,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/agg/fx_agg_driver \
     UnpackedTarball/pdfium/core/fxge/cfx_cliprgn \
     UnpackedTarball/pdfium/core/fxge/cfx_color \
-    UnpackedTarball/pdfium/core/fxge/cfx_facecache \
+    UnpackedTarball/pdfium/core/fxge/cfx_glyphcache \
     UnpackedTarball/pdfium/core/fxge/cfx_folderfontinfo \
     UnpackedTarball/pdfium/core/fxge/cfx_font \
     UnpackedTarball/pdfium/core/fxge/cfx_fontcache \
@@ -463,7 +468,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/cfx_renderdevice \
     UnpackedTarball/pdfium/core/fxge/cfx_substfont \
     UnpackedTarball/pdfium/core/fxge/cfx_unicodeencoding \
-    UnpackedTarball/pdfium/core/fxge/cttfontdesc \
     UnpackedTarball/pdfium/core/fxge/fx_ge_fontmap \
     UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
     UnpackedTarball/pdfium/core/fxge/cfx_glyphbitmap \
@@ -471,6 +475,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/text_glyph_pos \
     UnpackedTarball/pdfium/core/fxge/fx_font \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibbase \
+    UnpackedTarball/pdfium/core/fxge/dib/cfx_cmyk_to_srgb \
+    UnpackedTarball/pdfium/core/fxge/text_char_pos \
+    UnpackedTarball/pdfium/core/fxge/cfx_face \
 ))
 
 # javascript, build with pdf_enable_v8 disabled.
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index 9939b6e9e4b6..1d03c28a4d15 100644
--- a/external/pdfium/ubsan.patch
+++ b/external/pdfium/ubsan.patch
@@ -10,9 +10,9 @@
      m_String[offset + nLen] = 0;
    }
  
---- core/fxge/cfx_facecache.cpp
-+++ core/fxge/cfx_facecache.cpp
-@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph(
+--- core/fxge/cfx_glyphcache.cpp
++++ core/fxge/cfx_glyphcache.cpp
+@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_GlyphCache::RenderGlyph(
        }
      }
    } else {
diff --git a/external/pdfium/windows7.patch.1 b/external/pdfium/windows7.patch.1
index 5b793136f023..d33f273ff4ca 100644
--- a/external/pdfium/windows7.patch.1
+++ b/external/pdfium/windows7.patch.1
@@ -1,5 +1,5 @@
 diff --git a/third_party/base/win/win_util.cc b/third_party/base/win/win_util.cc
-index 9c90b9d62..356eca74d 100644
+index ae2dba84d..7a3718848 100644
 --- a/third_party/base/win/win_util.cc
 +++ b/third_party/base/win/win_util.cc
 @@ -12,28 +12,7 @@ namespace base {
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index e1d7120e9db2..f6147d3391e2 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -317,7 +317,7 @@ void PdfExportTest::testTdf105461()
             continue;
 
         unsigned int nRed = 0, nGreen = 0, nBlue = 0, nAlpha = 0;
-        FPDFPath_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
+        FPDFPageObj_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
         if (Color(nRed, nGreen, nBlue) == COL_YELLOW)
             ++nYellowPathCount;
     }
@@ -372,7 +372,7 @@ void PdfExportTest::testTdf107868()
             continue;
 
         unsigned int nRed = 0, nGreen = 0, nBlue = 0, nAlpha = 0;
-        FPDFPath_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
+        FPDFPageObj_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
         if (Color(nRed, nGreen, nBlue) == COL_WHITE)
             ++nWhitePathCount;
     }
@@ -807,7 +807,7 @@ void PdfExportTest::testTdf108963()
             continue;
 
         unsigned int nRed = 0, nGreen = 0, nBlue = 0, nAlpha = 0;
-        FPDFPath_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
+        FPDFPageObj_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
         if (Color(nRed, nGreen, nBlue) == COL_YELLOW)
         {
             ++nYellowPathCount;
commit 299bec7831111d5c141c1280cb7e8c51ee075c2b
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon May 20 21:37:39 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:16 2020 +0100

    external: update pdfium to 3794
    
    Reviewed-on: https://gerrit.libreoffice.org/72619
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 3dbe66b7895a412ad7ad9aede4be383489d805de)
    
    Change-Id: Ie4c42943445813c7c50bf06cb710cedf2a61f3a9

diff --git a/download.lst b/download.lst
index 643da2904e84..1b67034c336a 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := dfaaae78f1d371378c6b715862f9b3b67f9a6857c7864bfaebfd88a962d03bca
-export PDFIUM_TARBALL := pdfium-3730.tar.bz2
+export PDFIUM_SHA256SUM := e3faddcf741336c64ca2e6f72b23e9e60979969b2cf67c878c9a5bc38328cfc4
+export PDFIUM_TARBALL := pdfium-3794.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 2bfa8210676d..17417ac5b86e 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -200,7 +200,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pagemodule \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobject \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobjectholder \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobjectlist \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_path \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pathobject \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pattern \
@@ -630,6 +629,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/win32/fx_win32_gdipext \
     UnpackedTarball/pdfium/core/fxge/win32/fx_win32_print \
     UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \
+    UnpackedTarball/pdfium/third_party/base/win/win_util \
 ))
 
 $(eval $(call gb_Library_use_system_win32_libs,pdfium,\
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index eda4fd781e8d..8f493ea3a0d6 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -12,6 +12,8 @@ pdfium_patches += visibility.patch.1
 pdfium_patches += ubsan.patch
 # Fixes build on our baseline.
 pdfium_patches += build.patch.1
+# Avoids Windows 8 build dependency.
+pdfium_patches += windows7.patch.1
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
@@ -41,7 +43,8 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/partition_bucket.cc third_party/base/allocator/partition_allocator/partition_bucket.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_oom.cc third_party/base/allocator/partition_allocator/partition_oom.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_page.cc third_party/base/allocator/partition_allocator/partition_page.cpp && \
-    mv third_party/base/allocator/partition_allocator/partition_root_base.cc third_party/base/allocator/partition_allocator/partition_root_base.cpp \
+    mv third_party/base/allocator/partition_allocator/partition_root_base.cc third_party/base/allocator/partition_allocator/partition_root_base.cpp && \
+    mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index a1ec25e8b223..562b2e6198d3 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -71,16 +71,3 @@ index 7f4eb86c0..5e227f86e 100644
  };
  
  #endif  // CORE_FPDFDOC_CPDF_DEST_H_
-diff --git a/core/fpdfdoc/cpdf_filespec.h b/core/fpdfdoc/cpdf_filespec.h
-index 7050f695b..916afed8b 100644
---- a/core/fpdfdoc/cpdf_filespec.h
-+++ b/core/fpdfdoc/cpdf_filespec.h
-@@ -41,7 +41,7 @@ class CPDF_FileSpec {
- 
-  private:
-   UnownedPtr<const CPDF_Object> const m_pObj;
--  UnownedPtr<CPDF_Object> const m_pWritableObj;
-+  UnownedPtr<CPDF_Object> m_pWritableObj;
- };
- 
- #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
diff --git a/external/pdfium/visibility.patch.1 b/external/pdfium/visibility.patch.1
index 04e89b38ab10..9983723b2055 100644
--- a/external/pdfium/visibility.patch.1
+++ b/external/pdfium/visibility.patch.1
@@ -1,26 +1,41 @@
 diff --git a/public/fpdfview.h b/public/fpdfview.h
-index 1ff0aeb26..f48036f2b 100644
+index f5212599f..57d6cda13 100644
 --- a/public/fpdfview.h
 +++ b/public/fpdfview.h
-@@ -129,14 +129,20 @@ typedef int FPDF_ANNOTATION_SUBTYPE;
+@@ -154,31 +154,20 @@ typedef int FPDF_ANNOT_APPEARANCEMODE;
  // Dictionary value types.
  typedef int FPDF_OBJECT_TYPE;
  
--#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
--// On Windows system, functions are exported in a DLL
+-#if defined(COMPONENT_BUILD)
+-// FPDF_EXPORT should be consistent with |export| in the pdfium_fuzzer
+-// template in testing/fuzzers/BUILD.gn.
+-#if defined(WIN32)
+-#if defined(FPDF_IMPLEMENTATION)
 +#if defined(PDFIUM_DLLIMPLEMENTATION)
 +#ifdef _WIN32
  #define FPDF_EXPORT __declspec(dllexport)
--#define FPDF_CALLCONV __stdcall
  #else
+-#define FPDF_EXPORT __declspec(dllimport)
+-#endif  // defined(FPDF_IMPLEMENTATION)
+-#else
+-#if defined(FPDF_IMPLEMENTATION)
+-#define FPDF_EXPORT __attribute__((visibility("default")))
+-#else
 -#define FPDF_EXPORT
--#define FPDF_CALLCONV
+-#endif  // defined(FPDF_IMPLEMENTATION)
+-#endif  // defined(WIN32)
 +#define FPDF_EXPORT __attribute__ ((visibility("default")))
 +#endif
-+#else
+ #else
+-#define FPDF_EXPORT
+-#endif  // defined(COMPONENT_BUILD)
+-
+-#if defined(WIN32) && defined(FPDFSDK_EXPORTS)
+-#define FPDF_CALLCONV __stdcall
 +#ifdef _WIN32
 +#define FPDF_EXPORT __declspec(dllimport)
-+#else
+ #else
+-#define FPDF_CALLCONV
 +#define FPDF_EXPORT __attribute__ ((visibility("default")))
  #endif
 +#endif
diff --git a/external/pdfium/windows7.patch.1 b/external/pdfium/windows7.patch.1
new file mode 100644
index 000000000000..5b793136f023
--- /dev/null
+++ b/external/pdfium/windows7.patch.1
@@ -0,0 +1,34 @@
+diff --git a/third_party/base/win/win_util.cc b/third_party/base/win/win_util.cc
+index 9c90b9d62..356eca74d 100644
+--- a/third_party/base/win/win_util.cc
++++ b/third_party/base/win/win_util.cc
+@@ -12,28 +12,7 @@ namespace base {
+ namespace win {
+ 
+ bool IsUser32AndGdi32Available() {
+-  static auto is_user32_and_gdi32_available = []() {
+-    // If win32k syscalls aren't disabled, then user32 and gdi32 are available.
+-
+-    typedef decltype(
+-        GetProcessMitigationPolicy)* GetProcessMitigationPolicyType;
+-    GetProcessMitigationPolicyType get_process_mitigation_policy_func =
+-        reinterpret_cast<GetProcessMitigationPolicyType>(GetProcAddress(
+-            GetModuleHandle(L"kernel32.dll"), "GetProcessMitigationPolicy"));
+-
+-    if (!get_process_mitigation_policy_func)
+-      return true;
+-
+-    PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY policy = {};
+-    if (get_process_mitigation_policy_func(GetCurrentProcess(),
+-                                           ProcessSystemCallDisablePolicy,
+-                                           &policy, sizeof(policy))) {
+-      return policy.DisallowWin32kSystemCalls == 0;
+-    }
+-
+-    return true;
+-  }();
+-  return is_user32_and_gdi32_available;
++  return true;
+ }
+ 
+ }  // namespace win
commit ba62bf4077789557079a7523226dc542a8773bbc
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Apr 2 21:14:36 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:16 2020 +0100

    pdfium: avoid problems with SetForm using WIN32_LEAN_AND_MEAN
    
    So that it does not get defined to SetFormA() or SetFormW() and still
    requires no patching.
    
    Change-Id: I4364b02306633733d8536ebd8d7d42273dfeef74
    Reviewed-on: https://gerrit.libreoffice.org/70150
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 66c29fd202f22a36edbb929ddcc1f1cadb0a6e8f)

diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 4e22618f32b5..2bfa8210676d 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Library_add_defs,pdfium,\
     -DUSE_SYSTEM_ICUUC \
     -DMEMORY_TOOL_REPLACES_ALLOCATOR \
     -DUNICODE \
+    -DWIN32_LEAN_AND_MEAN \
 ))
 
 # Don't show warnings upstream doesn't care about.
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 0a4476ce1300..a1ec25e8b223 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -84,60 +84,3 @@ index 7050f695b..916afed8b 100644
  };
  
  #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
-diff --git a/fpdfsdk/cpdf_annotcontext.cpp b/fpdfsdk/cpdf_annotcontext.cpp
-index 0beebe1bf..4aeefb04e 100644
---- a/fpdfsdk/cpdf_annotcontext.cpp
-+++ b/fpdfsdk/cpdf_annotcontext.cpp
-@@ -21,7 +21,7 @@ CPDF_AnnotContext::CPDF_AnnotContext(CPDF_Dictionary* pAnnotDict,
- 
- CPDF_AnnotContext::~CPDF_AnnotContext() = default;
- 
--void CPDF_AnnotContext::SetForm(CPDF_Stream* pStream) {
-+void CPDF_AnnotContext::SetForm_(CPDF_Stream* pStream) {
-   if (!pStream)
-     return;
- 
-diff --git a/fpdfsdk/cpdf_annotcontext.h b/fpdfsdk/cpdf_annotcontext.h
-index cab81e7d4..ce24fff52 100644
---- a/fpdfsdk/cpdf_annotcontext.h
-+++ b/fpdfsdk/cpdf_annotcontext.h
-@@ -21,7 +21,7 @@ class CPDF_AnnotContext {
-   CPDF_AnnotContext(CPDF_Dictionary* pAnnotDict, CPDF_Page* pPage);
-   ~CPDF_AnnotContext();
- 
--  void SetForm(CPDF_Stream* pStream);
-+  void SetForm_(CPDF_Stream* pStream);
-   bool HasForm() const { return !!m_pAnnotForm; }
-   CPDF_Form* GetForm() const { return m_pAnnotForm.get(); }
- 
-diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
-index 8b4c69789..f6560059f 100644
---- a/fpdfsdk/fpdf_annot.cpp
-+++ b/fpdfsdk/fpdf_annot.cpp
-@@ -399,7 +399,7 @@ FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj) {
- 
-   // Get the annotation's corresponding form object for parsing its AP stream.
-   if (!pAnnot->HasForm())
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
- 
-   // Check that the object did not come from the same annotation. If this check
-   // succeeds, then it is assumed that the object came from
-@@ -435,7 +435,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot) {
-     if (!pStream)
-       return 0;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
-   return pdfium::CollectionSize<int>(*pAnnot->GetForm()->GetPageObjectList());
- }
-@@ -452,7 +452,7 @@ FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index) {
-     if (!pStream)
-       return nullptr;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
- 
-   return FPDFPageObjectFromCPDFPageObject(
commit 3c97473019ccaefbc38f9ec19ba3c128c594c9b2
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Mar 12 21:19:08 2019 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:16 2020 +0100

    external: update pdfium to 3730
    
    Change-Id: Iaaac797812b2addd1e5693dbb4338fc1c506a26d
    Reviewed-on: https://gerrit.libreoffice.org/69134
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 8743247493ba90098e3e32cf30de0e8995569852)

diff --git a/download.lst b/download.lst
index 5995a6caa635..643da2904e84 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 012ef554e7a6ec6d794f9ff7e66ff71011cab1b67317b427d9c820c48c141e5e
-export PDFIUM_TARBALL := pdfium-3667.tar.bz2
+export PDFIUM_SHA256SUM := dfaaae78f1d371378c6b715862f9b3b67f9a6857c7864bfaebfd88a962d03bca
+export PDFIUM_TARBALL := pdfium-3730.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 113466d818b8..4e22618f32b5 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -254,8 +254,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3cache \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphs \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_creator \
-    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_encryptor \
-    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_flateencoder \
+    UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_encryptor \
+    UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_flateencoder \
     UnpackedTarball/pdfium/core/fpdfapi/font/cfx_cttgsubtable \
     UnpackedTarball/pdfium/core/fpdfapi/font/cfx_stockfontarray \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cid2unicodemap \
@@ -466,7 +466,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/cttfontdesc \
     UnpackedTarball/pdfium/core/fxge/fx_ge_fontmap \
     UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
-    UnpackedTarball/pdfium/core/fxge/fx_ge_text \
+    UnpackedTarball/pdfium/core/fxge/cfx_glyphbitmap \
+    UnpackedTarball/pdfium/core/fxge/scoped_font_transform \
+    UnpackedTarball/pdfium/core/fxge/text_glyph_pos \
     UnpackedTarball/pdfium/core/fxge/fx_font \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibbase \
 ))
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 721c1784719d..0a4476ce1300 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -32,38 +32,6 @@ index 323de4ffc..f11a0b0ad 100644
  
    std::vector<UnsupportedFeature> unsupported;
    CheckForSharedFormInternal(doc->GetRoot(), &unsupported);
-diff --git a/fpdfsdk/cpdf_annotcontext.cpp b/fpdfsdk/cpdf_annotcontext.cpp
-index 20c5fc343..a40cd1eae 100644
---- a/fpdfsdk/cpdf_annotcontext.cpp
-+++ b/fpdfsdk/cpdf_annotcontext.cpp
-@@ -16,12 +16,12 @@ CPDF_AnnotContext::CPDF_AnnotContext(CPDF_Dictionary* pAnnotDict,
-                                      CPDF_Page* pPage,
-                                      CPDF_Stream* pStream)
-     : m_pAnnotDict(pAnnotDict), m_pPage(pPage) {
--  SetForm(pStream);
-+  SetForm_(pStream);
- }
- 
- CPDF_AnnotContext::~CPDF_AnnotContext() = default;
- 
--void CPDF_AnnotContext::SetForm(CPDF_Stream* pStream) {
-+void CPDF_AnnotContext::SetForm_(CPDF_Stream* pStream) {
-   if (!pStream)
-     return;
- 
-diff --git a/fpdfsdk/cpdf_annotcontext.h b/fpdfsdk/cpdf_annotcontext.h
-index 38cc91e03..7904ae044 100644
---- a/fpdfsdk/cpdf_annotcontext.h
-+++ b/fpdfsdk/cpdf_annotcontext.h
-@@ -23,7 +23,7 @@ class CPDF_AnnotContext {
-                     CPDF_Stream* pStream);
-   ~CPDF_AnnotContext();
- 
--  void SetForm(CPDF_Stream* pStream);
-+  void SetForm_(CPDF_Stream* pStream);
-   bool HasForm() const { return !!m_pAnnotForm; }
-   CPDF_Form* GetForm() const { return m_pAnnotForm.get(); }
-   CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict.Get(); }
 diff --git a/third_party/base/span.h b/third_party/base/span.h
 index 0fb627ba8..f71c362e2 100644
 --- a/third_party/base/span.h
@@ -77,37 +45,6 @@ index 0fb627ba8..f71c362e2 100644
    span& operator=(const span& other) noexcept = default;
    ~span() noexcept {
      if (!size_) {
-diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
-index d3bf38d31..e8aea9707 100644
---- a/fpdfsdk/fpdf_annot.cpp
-+++ b/fpdfsdk/fpdf_annot.cpp
-@@ -389,7 +389,7 @@ FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj) {
- 
-   // Get the annotation's corresponding form object for parsing its AP stream.
-   if (!pAnnot->HasForm())
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
- 
-   // Check that the object did not come from the same annotation. If this check
-   // succeeds, then it is assumed that the object came from
-@@ -425,7 +425,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot) {
-     if (!pStream)
-       return 0;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
-   return pdfium::CollectionSize<int>(*pAnnot->GetForm()->GetPageObjectList());
- }
-@@ -442,7 +442,7 @@ FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index) {
-     if (!pStream)
-       return nullptr;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
- 
-   return FPDFPageObjectFromCPDFPageObject(
 diff --git a/third_party/base/span.h b/third_party/base/span.h
 index 0fb627ba8..dda1fc8bc 100644
 --- a/third_party/base/span.h
@@ -147,3 +84,60 @@ index 7050f695b..916afed8b 100644
  };
  
  #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
+diff --git a/fpdfsdk/cpdf_annotcontext.cpp b/fpdfsdk/cpdf_annotcontext.cpp
+index 0beebe1bf..4aeefb04e 100644
+--- a/fpdfsdk/cpdf_annotcontext.cpp
++++ b/fpdfsdk/cpdf_annotcontext.cpp
+@@ -21,7 +21,7 @@ CPDF_AnnotContext::CPDF_AnnotContext(CPDF_Dictionary* pAnnotDict,
+ 
+ CPDF_AnnotContext::~CPDF_AnnotContext() = default;
+ 
+-void CPDF_AnnotContext::SetForm(CPDF_Stream* pStream) {
++void CPDF_AnnotContext::SetForm_(CPDF_Stream* pStream) {
+   if (!pStream)
+     return;
+ 
+diff --git a/fpdfsdk/cpdf_annotcontext.h b/fpdfsdk/cpdf_annotcontext.h
+index cab81e7d4..ce24fff52 100644
+--- a/fpdfsdk/cpdf_annotcontext.h
++++ b/fpdfsdk/cpdf_annotcontext.h
+@@ -21,7 +21,7 @@ class CPDF_AnnotContext {
+   CPDF_AnnotContext(CPDF_Dictionary* pAnnotDict, CPDF_Page* pPage);
+   ~CPDF_AnnotContext();
+ 
+-  void SetForm(CPDF_Stream* pStream);
++  void SetForm_(CPDF_Stream* pStream);
+   bool HasForm() const { return !!m_pAnnotForm; }
+   CPDF_Form* GetForm() const { return m_pAnnotForm.get(); }
+ 
+diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
+index 8b4c69789..f6560059f 100644
+--- a/fpdfsdk/fpdf_annot.cpp
++++ b/fpdfsdk/fpdf_annot.cpp
+@@ -399,7 +399,7 @@ FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj) {
+ 
+   // Get the annotation's corresponding form object for parsing its AP stream.
+   if (!pAnnot->HasForm())
+-    pAnnot->SetForm(pStream);
++    pAnnot->SetForm_(pStream);
+ 
+   // Check that the object did not come from the same annotation. If this check
+   // succeeds, then it is assumed that the object came from
+@@ -435,7 +435,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot) {
+     if (!pStream)
+       return 0;
+ 
+-    pAnnot->SetForm(pStream);
++    pAnnot->SetForm_(pStream);
+   }
+   return pdfium::CollectionSize<int>(*pAnnot->GetForm()->GetPageObjectList());
+ }
+@@ -452,7 +452,7 @@ FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index) {
+     if (!pStream)
+       return nullptr;
+ 
+-    pAnnot->SetForm(pStream);
++    pAnnot->SetForm_(pStream);
+   }
+ 
+   return FPDFPageObjectFromCPDFPageObject(
commit 0b6cb73855274b1979c0faf6e0f8f3d81ec02735
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jan 15 21:18:44 2019 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:16 2020 +0100

    external: update pdfium to 3667
    
    Reviewed-on: https://gerrit.libreoffice.org/66408
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 2044475c8cb33b76591aa6de77dd43a0bf9f5145)
    
    Change-Id: Ie4f0cc8f06432e182ce7ffcae5269075d12658ef

diff --git a/download.lst b/download.lst
index af6b49800cfc..5995a6caa635 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := c42cdff8e18b9369bc9383e0e8c2531b5631a2712852a26d8e7593021561de89
-export PDFIUM_TARBALL := pdfium-3613.tar.bz2
+export PDFIUM_SHA256SUM := 012ef554e7a6ec6d794f9ff7e66ff71011cab1b67317b427d9c820c48c141e5e
+export PDFIUM_TARBALL := pdfium-3667.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index f7406cf6d716..113466d818b8 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -372,7 +372,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/fx_memory \
     UnpackedTarball/pdfium/core/fxcrt/fx_stream \
     UnpackedTarball/pdfium/core/fxcrt/fx_system \
-    UnpackedTarball/pdfium/core/fxcrt/fx_ucddata \
     UnpackedTarball/pdfium/core/fxcrt/fx_unicode \
     UnpackedTarball/pdfium/core/fxcrt/xml/cfx_xmldocument \
     UnpackedTarball/pdfium/core/fxcrt/xml/cfx_xmlelement \
@@ -488,7 +487,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit_ctrl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit_impl \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_font_map \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_icon \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_box \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_impl \
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 1a223352ddf8..721c1784719d 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -147,16 +147,3 @@ index 7050f695b..916afed8b 100644
  };
  
  #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
-diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp
-index fabde1e80..92a423cc6 100644
---- a/core/fxcrt/fx_coordinates.cpp
-+++ b/core/fxcrt/fx_coordinates.cpp
-@@ -302,7 +302,7 @@ std::ostream& operator<<(std::ostream& os, const CFX_RectF& rect) {
- 
- std::tuple<float, float, float, float, float, float> CFX_Matrix::AsTuple()
-     const {
--  return {a, b, c, d, e, f};
-+  return std::tuple<float, float, float, float, float, float>(a, b, c, d, e, f);
- }
- 
- CFX_Matrix CFX_Matrix::GetInverse() const {
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index ec1ac90d7e19..67b822e2f7e1 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -93,8 +93,8 @@
                     "type": "shell"
                 },
                 {
-                    "url": "https://dev-www.libreoffice.org/src/pdfium-3426.tar.bz2",
-                    "sha256": "80331b48166501a192d65476932f17044eeb5f10faa6ea50f4f175169475c957",
+                    "url": "https://dev-www.libreoffice.org/src/pdfium-3667.tar.bz2",
+                    "sha256": "012ef554e7a6ec6d794f9ff7e66ff71011cab1b67317b427d9c820c48c141e5e",
                     "type": "file",
                     "dest-filename": "external/tarballs/pdfium-3426.tar.bz2"
                 },
commit 77afc559c24a6bb13efda3e3f95bce7081b68018
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Nov 19 09:03:40 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:16 2020 +0100

    external: update pdfium to 3613
    
    Reviewed-on: https://gerrit.libreoffice.org/63547
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit ec11c1aee04eacb00d94a6359f959b990ddb6923)
    
    Change-Id: I99bd67f45796eb85635543a5e4563bb7477cf63e

diff --git a/download.lst b/download.lst
index d33ad53761b7..af6b49800cfc 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 572460f7f9e2f86d022a9c6a82f1e2ded6c3c29ba352d4b9fac60b87e2159679
-export PDFIUM_TARBALL := pdfium-3550.tar.bz2
+export PDFIUM_SHA256SUM := c42cdff8e18b9369bc9383e0e8c2531b5631a2712852a26d8e7593021561de89
+export PDFIUM_TARBALL := pdfium-3613.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index 8283f6dd0aa1..f7406cf6d716 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -47,9 +47,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annotiteration \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannot \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannothandler \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_datetime \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_formfillenvironment \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interform \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pageview \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widget \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widgethandler \
@@ -81,13 +79,14 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_view \
     UnpackedTarball/pdfium/fpdfsdk/ipdfsdk_pauseadapter \
     UnpackedTarball/pdfium/fpdfsdk/cpdf_annotcontext \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
 ))
 
 # fdrm
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt \
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt_aes \
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt_sha \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt_aes \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt_sha \
 ))
 
 # formfiller
@@ -185,7 +184,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_color \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_colorspace \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_colorstate \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmark \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmarks \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmarkitem \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentparser \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_docpagedata \
@@ -303,7 +302,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formcontrol \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formfield \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_iconfit \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_interform \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_interactiveform \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_link \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_linklist \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_metadata \
@@ -413,6 +412,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/cfx_seekablemultistream \
     UnpackedTarball/pdfium/core/fxcrt/css/cfx_cssdata \
     UnpackedTarball/pdfium/core/fxcrt/fx_codepage \
+    UnpackedTarball/pdfium/core/fxcrt/fx_number \
     UnpackedTarball/pdfium/core/fxcrt/cfx_utf8encoder \
     UnpackedTarball/pdfium/core/fxcrt/cfx_readonlymemorystream \
 ))
@@ -468,6 +468,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/fx_ge_fontmap \
     UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
     UnpackedTarball/pdfium/core/fxge/fx_ge_text \
+    UnpackedTarball/pdfium/core/fxge/fx_font \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibbase \
 ))
 
@@ -546,6 +547,11 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/spin_lock \
     UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_alloc \
     UnpackedTarball/pdfium/third_party/base/debug/alias \
+    UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/oom_callback \
+    UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_bucket \
+    UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_oom \
+    UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_page \
+    UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_root_base \
 ))
 
 # skia_shared
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index aaaab0c25ac1..eda4fd781e8d 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -36,7 +36,12 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/page_allocator.cc third_party/base/allocator/partition_allocator/page_allocator.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_alloc.cc third_party/base/allocator/partition_allocator/partition_alloc.cpp && \
     mv third_party/base/allocator/partition_allocator/spin_lock.cc third_party/base/allocator/partition_allocator/spin_lock.cpp && \
-	mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp \
+    mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp && \
+    mv third_party/base/allocator/partition_allocator/oom_callback.cc third_party/base/allocator/partition_allocator/oom_callback.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_bucket.cc third_party/base/allocator/partition_allocator/partition_bucket.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_oom.cc third_party/base/allocator/partition_allocator/partition_oom.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_page.cc third_party/base/allocator/partition_allocator/partition_page.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_root_base.cc third_party/base/allocator/partition_allocator/partition_root_base.cpp \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 721c1784719d..1a223352ddf8 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -147,3 +147,16 @@ index 7050f695b..916afed8b 100644
  };
  
  #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
+diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp
+index fabde1e80..92a423cc6 100644
+--- a/core/fxcrt/fx_coordinates.cpp
++++ b/core/fxcrt/fx_coordinates.cpp
+@@ -302,7 +302,7 @@ std::ostream& operator<<(std::ostream& os, const CFX_RectF& rect) {
+ 
+ std::tuple<float, float, float, float, float, float> CFX_Matrix::AsTuple()
+     const {
+-  return {a, b, c, d, e, f};
++  return std::tuple<float, float, float, float, float, float>(a, b, c, d, e, f);
+ }
+ 
+ CFX_Matrix CFX_Matrix::GetInverse() const {
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index 91428326fc5d..9939b6e9e4b6 100644
--- a/external/pdfium/ubsan.patch
+++ b/external/pdfium/ubsan.patch
@@ -1,9 +1,9 @@
 --- core/fxcrt/string_data_template.h
 +++ core/fxcrt/string_data_template.h
-@@ -78,7 +78,8 @@
+@@ -76,7 +76,8 @@ class StringDataTemplate {
+     ASSERT(nLen >= 0);
+     ASSERT(offset + nLen <= m_nAllocLength);
  
-   void CopyContentsAt(size_t offset, const CharType* pStr, size_t nLen) {
-     ASSERT(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength);
 -    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
 +    if (nLen != 0)
 +      memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
commit 021187273ac8b0e7965b814da19cdbb487b44268
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Tue Sep 18 21:07:10 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 3 02:20:16 2020 +0100

    pdfium: update to 3550
    
    Allows dropping all the backports, so only one custom API patch remains.
    
    Reviewed-on: https://gerrit.libreoffice.org/60697
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 56ac8214ab35387f8861044b62c79fae6d7ccac5)
    
    Change-Id: I13dc4f62be86d0859862cbd95bb14e07bbcf53d6

diff --git a/download.lst b/download.lst
index 3d848e027963..d33ad53761b7 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 4acbc905fee1743e96169ca155347a81fb2b0f381281109c1860aa4408ec6c4f
-export PDFIUM_TARBALL := pdfium-3471.tar.bz2
+export PDFIUM_SHA256SUM := 572460f7f9e2f86d022a9c6a82f1e2ded6c3c29ba352d4b9fac60b87e2159679
+export PDFIUM_TARBALL := pdfium-3550.tar.bz2
 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list