download.lst                                   |    4 
 external/pdfium/Library_pdfium.mk              |   12 ++
 external/pdfium/build.patch.1                  |  109 ++++++++++++++++++++++++-
 external/pdfium/inc/pch/precompiled_pdfium.hxx |   16 ++-
 external/pdfium/ubsan.patch                    |    8 -
 solenv/flatpak-manifest.in                     |    7 -
 svx/source/svdraw/svdpdf.cxx                   |    9 +-
 vcl/qa/cppunit/pdfexport/pdfexport.cxx         |    5 -
 8 files changed, 145 insertions(+), 25 deletions(-)

New commits:
commit acc9e42d57c333705e9bfd9367b5322ca84011bf
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Jul 13 20:28:17 2021 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Nov 11 10:24:03 2021 +0100

    external: update pdfium to 4568
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118868
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit 7707339a7d10225ff2503a852f68427519ae26f6)
    
    Change-Id: I2bfd5f806281e747702d423b7e59b5f88a7bea9c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124994
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/download.lst b/download.lst
index 164b3692f266..4bb187e1b5f8 100644
--- a/download.lst
+++ b/download.lst
@@ -202,8 +202,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 := 
26a03dd60e5ed0979cdaba9cc848242895110ddfdf347d40989ce2f14020f304
-export PDFIUM_TARBALL := pdfium-4500.tar.bz2
+export PDFIUM_SHA256SUM := 
b0c5725e1cdcef7f52f068fd33adf9e8d833a271c28ba5b6a5a576ef8f2bbbf4
+export PDFIUM_TARBALL := pdfium-4568.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 9f6e347cfb14..5ba04fda321b 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -77,6 +77,12 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_renderpage \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_signature \
+       UnpackedTarball/pdfium/constants/annotation_common \
+       UnpackedTarball/pdfium/constants/appearance \
+       UnpackedTarball/pdfium/constants/form_fields \
+       UnpackedTarball/pdfium/constants/page_object \
+       UnpackedTarball/pdfium/constants/stream_dict_common \
+       UnpackedTarball/pdfium/constants/transparency \
 ))
 
 # fdrm
@@ -90,7 +96,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_checkbox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_combobox \
-    UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_formfiller \
+    UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_formfield \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_listbox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_pushbutton \
@@ -347,7 +353,7 @@ $(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_lzwdecompressor \
+    UnpackedTarball/pdfium/core/fxcodec/gif/lzw_decompressor \
     UnpackedTarball/pdfium/core/fxcodec/cfx_codec_memory \
     UnpackedTarball/pdfium/core/fxcodec/fax/faxmodule \
     UnpackedTarball/pdfium/core/fxcodec/scanlinedecoder \
@@ -460,7 +466,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/cfx_gemodule \
     UnpackedTarball/pdfium/core/fxge/cfx_graphstate \
     UnpackedTarball/pdfium/core/fxge/cfx_graphstatedata \
-    UnpackedTarball/pdfium/core/fxge/cfx_pathdata \
+    UnpackedTarball/pdfium/core/fxge/cfx_path \
     UnpackedTarball/pdfium/core/fxge/cfx_renderdevice \
     UnpackedTarball/pdfium/core/fxge/cfx_substfont \
     UnpackedTarball/pdfium/core/fxge/cfx_unicodeencoding \
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index f30b66b2e980..74e6f405c35d 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -53,12 +53,115 @@ index 0fb627ba8..dda1fc8bc 100644
    uint8_t r;
    uint8_t g;
 diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp 
b/core/fxcodec/jpx/cjpx_decoder.cpp
-index dbc1b1045..36b72461d 100644
+index c66985a7f..9c1122b75 100644
 --- 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) {
+@@ -6,6 +6,8 @@
+ 
+ #include "core/fxcodec/jpx/cjpx_decoder.h"
+ 
++#include <string.h>
++
+ #include <algorithm>
+ #include <limits>
+ #include <utility>
+diff --git a/core/fxcodec/jpeg/jpegmodule.cpp 
b/core/fxcodec/jpeg/jpegmodule.cpp
+index cea0679aa..036f25003 100644
+--- a/core/fxcodec/jpeg/jpegmodule.cpp
++++ b/core/fxcodec/jpeg/jpegmodule.cpp
+@@ -7,6 +7,7 @@
+ #include "core/fxcodec/jpeg/jpegmodule.h"
+ 
+ #include <setjmp.h>
++#include <string.h>
+ 
+ #include <memory>
+ #include <utility>
+diff --git a/core/fxge/dib/cfx_bitmapcomposer.cpp 
b/core/fxge/dib/cfx_bitmapcomposer.cpp
+index 6f9b42013..0f1ffae2c 100644
+--- a/core/fxge/dib/cfx_bitmapcomposer.cpp
++++ b/core/fxge/dib/cfx_bitmapcomposer.cpp
+@@ -6,6 +6,8 @@
+ 
+ #include "core/fxge/dib/cfx_bitmapcomposer.h"
+ 
++#include <string.h>
++
+ #include "core/fxge/cfx_cliprgn.h"
+ #include "core/fxge/dib/cfx_dibitmap.h"
+ 
+diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
+index d7ccf6cfa..94e8accdd 100644
+--- a/core/fxge/dib/cfx_dibitmap.cpp
++++ b/core/fxge/dib/cfx_dibitmap.cpp
+@@ -6,6 +6,8 @@
+ 
+ #include "core/fxge/dib/cfx_dibitmap.h"
+ 
++#include <string.h>
++
+ #include <limits>
+ #include <memory>
+ #include <utility>
+diff --git a/core/fxge/dib/cfx_bitmapstorer.cpp 
b/core/fxge/dib/cfx_bitmapstorer.cpp
+index f57c00eaa..45a0a180c 100644
+--- a/core/fxge/dib/cfx_bitmapstorer.cpp
++++ b/core/fxge/dib/cfx_bitmapstorer.cpp
+@@ -6,6 +6,8 @@
+ 
+ #include "core/fxge/dib/cfx_bitmapstorer.h"
+ 
++#include <string.h>
++
+ #include <utility>
+ 
+ #include "core/fxge/dib/cfx_dibitmap.h"
+diff --git a/core/fxge/cfx_cliprgn.cpp b/core/fxge/cfx_cliprgn.cpp
+index 5369d522c..d198852e3 100644
+--- a/core/fxge/cfx_cliprgn.cpp
++++ b/core/fxge/cfx_cliprgn.cpp
+@@ -6,6 +6,8 @@
+ 
+ #include "core/fxge/cfx_cliprgn.h"
+ 
++#include <string.h>
++
+ #include <utility>
+ 
+ #include "core/fxge/dib/cfx_dibitmap.h"
+diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp 
b/core/fxge/dib/cfx_scanlinecompositor.cpp
+index e8362d708..c04c6dcab 100644
+--- a/core/fxge/dib/cfx_scanlinecompositor.cpp
++++ b/core/fxge/dib/cfx_scanlinecompositor.cpp
+@@ -6,6 +6,8 @@
+ 
+ #include "core/fxge/dib/cfx_scanlinecompositor.h"
+ 
++#include <string.h>
++
+ #include <algorithm>
+ 
+ #include "core/fxge/dib/fx_dib.h"
+diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
+index 4ec0ddbf9..a1de2fbec 100644
+--- a/core/fxge/dib/cfx_dibbase.cpp
++++ b/core/fxge/dib/cfx_dibbase.cpp
+@@ -6,6 +6,8 @@
+ 
+ #include "core/fxge/dib/cfx_dibbase.h"
+ 
++#include <string.h>
++
+ #include <algorithm>
+ #include <memory>
+ #include <utility>
+diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp 
b/core/fxcodec/jpx/cjpx_decoder.cpp
+index c66985a7f..817f81dfa 100644
+--- a/core/fxcodec/jpx/cjpx_decoder.cpp
++++ b/core/fxcodec/jpx/cjpx_decoder.cpp
+@@ -71,7 +71,7 @@ Optional<OpjImageRgbData> alloc_rgb(size_t size) {
    if (!data.b)
-     return {};
+     return pdfium::nullopt;
  
 -  return data;
 +  return std::move(data);
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 0c41c8cd1e9d..c13f593c8b3a 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -46,6 +46,7 @@
 #include <limits>
 #include <list>
 #include <map>
+#include <math.h>
 #include <memory>
 #include <numeric>
 #include <ostream>
@@ -53,6 +54,7 @@
 #include <setjmp.h>
 #include <sstream>
 #include <stack>
+#include <stdarg.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
@@ -70,6 +72,7 @@
 #include <constants/access_permissions.h>
 #include <constants/annotation_common.h>
 #include <constants/annotation_flags.h>
+#include <constants/appearance.h>
 #include <constants/form_fields.h>
 #include <constants/form_flags.h>
 #include <constants/page_object.h>
@@ -241,7 +244,7 @@
 #include <core/fxcodec/flate/flatemodule.h>
 #include <core/fxcodec/fx_codec.h>
 #include <core/fxcodec/gif/cfx_gif.h>
-#include <core/fxcodec/gif/cfx_lzwdecompressor.h>
+#include <core/fxcodec/gif/lzw_decompressor.h>
 #include <core/fxcodec/icc/iccmodule.h>
 #include <core/fxcodec/jbig2/JBig2_ArithDecoder.h>
 #include <core/fxcodec/jbig2/JBig2_ArithIntDecoder.h>
@@ -319,6 +322,9 @@
 #include <core/fxcrt/observed_ptr.h>
 #include <core/fxcrt/pauseindicator_iface.h>
 #include <core/fxcrt/retain_ptr.h>
+#include <core/fxcrt/scoped_set_insertion.h>
+#include <core/fxcrt/span_util.h>
+#include <core/fxcrt/stl_util.h>
 #include <core/fxcrt/string_data_template.h>
 #include <core/fxcrt/string_pool_template.h>
 #include <core/fxcrt/unowned_ptr.h>
@@ -347,7 +353,7 @@
 #include <core/fxge/cfx_glyphcache.h>
 #include <core/fxge/cfx_graphstate.h>
 #include <core/fxge/cfx_graphstatedata.h>
-#include <core/fxge/cfx_pathdata.h>
+#include <core/fxge/cfx_path.h>
 #include <core/fxge/cfx_renderdevice.h>
 #include <core/fxge/cfx_substfont.h>
 #include <core/fxge/cfx_textrenderoptions.h>
@@ -396,7 +402,7 @@
 #include <fpdfsdk/formfiller/cffl_button.h>
 #include <fpdfsdk/formfiller/cffl_checkbox.h>
 #include <fpdfsdk/formfiller/cffl_combobox.h>
-#include <fpdfsdk/formfiller/cffl_formfiller.h>
+#include <fpdfsdk/formfiller/cffl_formfield.h>
 #include <fpdfsdk/formfiller/cffl_interactiveformfiller.h>
 #include <fpdfsdk/formfiller/cffl_listbox.h>
 #include <fpdfsdk/formfiller/cffl_privatedata.h>
@@ -472,16 +478,18 @@
 #include <third_party/base/check_op.h>
 #include <third_party/base/compiler_specific.h>
 #include <third_party/base/containers/adapters.h>
+#include <third_party/base/containers/contains.h>
+#include <third_party/base/cxx17_backports.h>
 #include <third_party/base/debug/alias.h>
 #include <third_party/base/memory/aligned_memory.h>
 #include <third_party/base/no_destructor.h>
 #include <third_party/base/notreached.h>
+#include <third_party/base/numerics/ranges.h>
 #include <third_party/base/numerics/safe_conversions.h>
 #include <third_party/base/numerics/safe_math.h>
 #include <third_party/base/optional.h>
 #include <third_party/base/ptr_util.h>
 #include <third_party/base/span.h>
-#include <third_party/base/stl_util.h>
 #include <third_party/skia_shared/SkFloatToDecimal.h>
 #endif // PCH_LEVEL >= 3
 #if PCH_LEVEL >= 4
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index cd48b3ee4803..bc9868244275 100644
--- a/external/pdfium/ubsan.patch
+++ b/external/pdfium/ubsan.patch
@@ -1,9 +1,9 @@
 --- core/fxcrt/string_data_template.cpp
 +++ core/fxcrt/string_data_template.cpp
-@@ -83,7 +83,8 @@ void StringDataTemplate<CharType>::CopyContentsAt(size_t 
offset,
-   DCHECK(nLen >= 0);
-   DCHECK(offset + nLen <= m_nAllocLength);
- 
+@@ -82,7 +82,8 @@ void StringDataTemplate<CharType>::CopyContentsAt(size_t 
offset,
+   DCHECK_GE(offset, 0);
+   DCHECK_GE(nLen, 0);
+   DCHECK_LE(offset + nLen, m_nAllocLength);
 -  memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
 +  if (nLen != 0)
 +    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 87bb16885f04..64fa57427e01 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -69,10 +69,11 @@
                     "type": "shell"
                 },
                 {
-                    "url": 
"https://dev-www.libreoffice.org/src/pdfium-4500.tar.bz2";,
-                    "sha256": 
"26a03dd60e5ed0979cdaba9cc848242895110ddfdf347d40989ce2f14020f304",
+                    "url": 
"https://dev-www.libreoffice.org/src/pdfium-4568.tar.bz2";,
+                    "sha256": 
"b0c5725e1cdcef7f52f068fd33adf9e8d833a271c28ba5b6a5a576ef8f2bbbf4",
                     "type": "file",
-                    "dest-filename": "external/tarballs/pdfium-4500.tar.bz2"
+                    "dest": "external/tarballs",
+                    "dest-filename": "pdfium-4568.tar.bz2"
                 },
                 {
                     "url": 
"https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz";,
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index c9a18c1dfcf9..32bffbb49452 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -758,7 +758,7 @@ void ImpSdrPdfImport::ImportForm(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     const Matrix aOldMatrix = mCurMatrix;
 
     FS_MATRIX matrix;
-    FPDFFormObj_GetMatrix(pPageObject, &matrix);
+    FPDFPageObj_GetMatrix(pPageObject, &matrix);
     mCurMatrix = Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, 
matrix.f);
 
     const int nCount = FPDFFormObj_CountObjects(pPageObject);
@@ -788,7 +788,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
         return;
 
     FS_MATRIX matrix;
-    FPDFTextObj_GetMatrix(pPageObject, &matrix);
+    FPDFPageObj_GetMatrix(pPageObject, &matrix);
     Matrix aTextMatrix(mCurMatrix);
 
     aTextMatrix.Transform(left, right, top, bottom);
@@ -805,7 +805,8 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
 
     OUString sText(pText.get(), nActualChars);
 
-    const double dFontSize = FPDFTextObj_GetFontSize(pPageObject);
+    float dFontSize{};
+    FPDFTextObj_GetFontSize(pPageObject, &dFontSize);
     double dFontSizeH = fabs(sqrt2(matrix.a, matrix.c) * dFontSize);
     double dFontSizeV = fabs(sqrt2(matrix.b, matrix.d) * dFontSize);
     dFontSizeH = lcl_PointToPixel(dFontSizeH);
@@ -1024,7 +1025,7 @@ void ImpSdrPdfImport::ImportImage(FPDF_PAGEOBJECT 
pPageObject, int /*nPageObject
 void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int 
/*nPageObjectIndex*/)
 {
     FS_MATRIX matrix;
-    FPDFPath_GetMatrix(pPageObject, &matrix);
+    FPDFPageObj_GetMatrix(pPageObject, &matrix);
     Matrix aPathMatrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, 
matrix.f);
     aPathMatrix.Concatinate(mCurMatrix);
 
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 723202eccf15..95425b128495 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -674,7 +674,8 @@ void PdfExportTest::testSofthyphenPos()
         FPDF_PAGEOBJECT pPdfPageObject = FPDFPage_GetObject(pPdfPage.get(), i);
         CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_TEXT, 
FPDFPageObj_GetType(pPdfPageObject));
         haveText = true;
-        double const size(FPDFTextObj_GetFontSize(pPdfPageObject));
+        float size{};
+        FPDFTextObj_GetFontSize(pPdfPageObject, &size);
         CPPUNIT_ASSERT_DOUBLES_EQUAL(11.05, size, 1E-06);
     }
 
@@ -1950,7 +1951,7 @@ void PdfExportTest::testPdfImageResourceInlineXObjectRef()
     FPDF_PAGEOBJECT pImage = FPDFFormObj_GetObject(pInnerFormObject, 0);
     CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_IMAGE, FPDFPageObj_GetType(pImage));
     FS_MATRIX aMatrix;
-    FPDFFormObj_GetMatrix(pInnerFormObject, &aMatrix);
+    FPDFPageObj_GetMatrix(pInnerFormObject, &aMatrix);
     basegfx::B2DHomMatrix aMat{ aMatrix.a, aMatrix.c, aMatrix.e, aMatrix.b, 
aMatrix.d, aMatrix.f };
     basegfx::B2DTuple aScale;
     basegfx::B2DTuple aTranslate;

Reply via email to