download.lst                                   |    4 +-
 external/pdfium/Library_pdfium.mk              |    8 -----
 external/pdfium/build.patch.1                  |   40 +++----------------------
 external/pdfium/inc/pch/precompiled_pdfium.hxx |   19 ++++++-----
 external/pdfium/ubsan.patch                    |   21 -------------
 5 files changed, 18 insertions(+), 74 deletions(-)

New commits:
commit 4afd83245b6ab2232032c74b1d242122fc734352
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Aug 14 19:59:32 2023 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Aug 15 11:00:12 2023 +0200

    Update pdfium to 5941
    
    - Remove part of ubsan.patch, upstream switched to FXSYS_memcpy() in
      those two functions, which does the same length check as our patch
      did.
    
    - Part of build.patch.1 doesn't apply anymore, remove the FXFT_Free()
      part and just assume that the new FT_Done_MM_Var() introduced in
      freetype-2.9 is something we can use unconditionally (at least the
      almalinux 8 has freetype-2.9.1).
    
    Change-Id: I77efc9921e76957edbcb68e8f3861ab5194b31e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155678
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/download.lst b/download.lst
index 15cffa81d5f9..4e3f1f3798be 100644
--- a/download.lst
+++ b/download.lst
@@ -438,8 +438,8 @@ PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-PDFIUM_SHA256SUM := 
b1052ff24e9ffb11af017c444bb0f6ad508d64c9a0fb88cacb0e8210245dde06
-PDFIUM_TARBALL := pdfium-5778.tar.bz2
+PDFIUM_SHA256SUM := 
9a9ce3f62de525cdfd8373a155ac549579c2c8067c6050716ca4b5cd5c11f655
+PDFIUM_TARBALL := pdfium-5941.tar.bz2
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/pdfium/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index bdab04c6861d..488c890da6ef 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -414,14 +414,12 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/cfx_datetime \
     UnpackedTarball/pdfium/core/fxcrt/bytestring \
     UnpackedTarball/pdfium/core/fxcrt/cfx_bitstream \
-    UnpackedTarball/pdfium/core/fxcrt/cfx_utf8decoder \
     UnpackedTarball/pdfium/core/fxcrt/fx_random \
     UnpackedTarball/pdfium/core/fxcrt/fx_string \
     UnpackedTarball/pdfium/core/fxcrt/widestring \
     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/observed_ptr \
     UnpackedTarball/pdfium/core/fxcrt/string_data_template \
     UnpackedTarball/pdfium/core/fxcrt/binary_buffer \
@@ -436,7 +434,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapcomposer \
     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/cfx_drawutils \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagerenderer \
@@ -571,11 +568,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/third_party/base/memory/aligned_memory \
 ))
 
-# skia_shared
-$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/third_party/skia_shared/SkFloatToDecimal \
-))
-
 $(eval $(call gb_Library_use_externals,pdfium,\
     libjpeg \
     lcms2 \
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 2c177b3b61a4..4853e4f90a45 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -60,7 +60,7 @@ diff --git a/core/fpdfdoc/cpdf_metadata.cpp 
b/core/fpdfdoc/cpdf_metadata.cpp
 index 228a0c137..bf512beb3 100644
 --- a/core/fpdfdoc/cpdf_metadata.cpp
 +++ b/core/fpdfdoc/cpdf_metadata.cpp
-@@ -77,7 +77,7 @@ std::vector<UnsupportedFeature> 
CPDF_Metadata::CheckForSharedForm() const {
+@@ -87,7 +87,7 @@ std::vector<UnsupportedFeature> 
CPDF_Metadata::CheckForSharedForm() const {
    CFX_XMLParser parser(stream);
    std::unique_ptr<CFX_XMLDocument> doc = parser.Parse();
    if (!doc)
@@ -68,7 +68,7 @@ index 228a0c137..bf512beb3 100644
 +    return std::vector<UnsupportedFeature>();
  
    std::vector<UnsupportedFeature> unsupported;
-   CheckForSharedFormInternal(doc->GetRoot(), &unsupported);
+   CheckForSharedFormInternal(/*depth=*/0, doc->GetRoot(), &unsupported);
 diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp 
b/core/fxcodec/jpx/cjpx_decoder.cpp
 index 9391d61ab..490ce2230 100644
 --- a/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -82,36 +82,6 @@ index 9391d61ab..490ce2230 100644
  }
  
  void sycc_to_rgb(int offset,
-diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
-index a2a44df39..d6cedee46 100644
---- a/core/fxge/cfx_font.cpp
-+++ b/core/fxge/cfx_font.cpp
-@@ -48,25 +48,9 @@ struct OUTLINE_PARAMS {
- // TODO(crbug.com/pdfium/1400): When FT_Done_MM_Var() is more likely to be
- // available to all users in the future, remove FreeMMVar() and use
- // FT_Done_MM_Var() directly.
--//
--// Use weak symbols to check if FT_Done_MM_Var() is available at runtime.
--#if !BUILDFLAG(IS_WIN)
--extern "C" __attribute__((weak)) decltype(FT_Done_MM_Var) FT_Done_MM_Var;
--#endif
- 
- void FreeMMVar(FXFT_FaceRec* rec, FXFT_MM_VarPtr variation_desc) {
--#if BUILDFLAG(IS_WIN)
--  // Assume `use_system_freetype` GN var is never set on Windows.
--  constexpr bool has_ft_done_mm_var_func = true;
--#else
--  static const bool has_ft_done_mm_var_func = !!FT_Done_MM_Var;
--#endif
--  if (has_ft_done_mm_var_func) {
--    FT_Done_MM_Var(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(),
--                   variation_desc);
--  } else {
-     FXFT_Free(rec, variation_desc);
--  }
- }
- 
- FX_RECT FXRectFromFTPos(FT_Pos left, FT_Pos top, FT_Pos right, FT_Pos bottom) 
{
 diff --git a/third_party/base/numerics/safe_conversions_impl.h 
b/third_party/base/numerics/safe_conversions_impl.h
 index 44c921a14..0152a89b7 100644
 --- a/third_party/base/numerics/safe_conversions_impl.h
@@ -125,10 +95,10 @@ index 44c921a14..0152a89b7 100644
  
  // TODO(jschuh): Debug builds don't reliably propagate constants, so we 
restrict
  // some accelerated runtime paths to release builds until this can be forced
-diff --git a/third_party/base/span.h b/third_party/base/span.h
+diff --git a/third_party/base/containers/span.h 
b/third_party/base/containers/span.h
 index ed2a3c8de..87493861c 100644
---- a/third_party/base/span.h
-+++ b/third_party/base/span.h
+--- a/third_party/base/containers/span.h
++++ b/third_party/base/containers/span.h
 @@ -211,7 +211,7 @@ class TRIVIAL_ABI GSL_POINTER span {
  #else
    template <typename Container,
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 6258e8036360..64795df4054d 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-11-08 17:05:53 using:
+ Generated on 2023-08-15 08:05:49 using:
  ./bin/update_pch external/pdfium pdfium --cutoff=1 --exclude:system 
--include:module --include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -47,6 +47,7 @@
 #include <new>
 #include <numeric>
 #include <ostream>
+#include <queue>
 #include <set>
 #include <setjmp.h>
 #include <sstream>
@@ -187,6 +188,7 @@
 #include <core/fpdfapi/parser/cpdf_syntax_parser.h>
 #include <core/fpdfapi/parser/fpdf_parser_decode.h>
 #include <core/fpdfapi/parser/fpdf_parser_utility.h>
+#include <core/fpdfapi/parser/object_tree_traversal_util.h>
 #include <core/fpdfapi/render/charposlist.h>
 #include <core/fpdfapi/render/cpdf_devicebuffer.h>
 #include <core/fpdfapi/render/cpdf_docrenderdata.h>
@@ -283,8 +285,7 @@
 #include <core/fxcrt/cfx_read_only_vector_stream.h>
 #include <core/fxcrt/cfx_seekablestreamproxy.h>
 #include <core/fxcrt/cfx_timer.h>
-#include <core/fxcrt/cfx_utf8decoder.h>
-#include <core/fxcrt/cfx_utf8encoder.h>
+#include <core/fxcrt/code_point_view.h>
 #include <core/fxcrt/css/cfx_css.h>
 #include <core/fxcrt/css/cfx_csscolorvalue.h>
 #include <core/fxcrt/css/cfx_csscomputedstyle.h>
@@ -317,6 +318,7 @@
 #include <core/fxcrt/fx_coordinates.h>
 #include <core/fxcrt/fx_extension.h>
 #include <core/fxcrt/fx_folder.h>
+#include <core/fxcrt/fx_memcpy_wrappers.h>
 #include <core/fxcrt/fx_memory.h>
 #include <core/fxcrt/fx_memory_wrappers.h>
 #include <core/fxcrt/fx_number.h>
@@ -337,7 +339,10 @@
 #include <core/fxcrt/stl_util.h>
 #include <core/fxcrt/string_data_template.h>
 #include <core/fxcrt/string_pool_template.h>
+#include <core/fxcrt/string_view_template.h>
 #include <core/fxcrt/unowned_ptr.h>
+#include <core/fxcrt/unowned_ptr_exclusion.h>
+#include <core/fxcrt/utf16.h>
 #include <core/fxcrt/widestring.h>
 #include <core/fxcrt/widetext_buffer.h>
 #include <core/fxcrt/xml/cfx_xmlchardata.h>
@@ -374,7 +379,6 @@
 #include <core/fxge/dib/cfx_bitmapstorer.h>
 #include <core/fxge/dib/cfx_cmyk_to_srgb.h>
 #include <core/fxge/dib/cfx_dibbase.h>
-#include <core/fxge/dib/cfx_dibextractor.h>
 #include <core/fxge/dib/cfx_dibitmap.h>
 #include <core/fxge/dib/cfx_imagerenderer.h>
 #include <core/fxge/dib/cfx_imagestretcher.h>
@@ -455,6 +459,7 @@
 #include <public/fpdf_transformpage.h>
 #include <public/fpdfview.h>
 #include <third_party/abseil-cpp/absl/types/optional.h>
+#include <third_party/abseil-cpp/absl/types/variant.h>
 #include <third_party/agg23/agg_clip_liang_barsky.h>
 #include <third_party/agg23/agg_conv_dash.h>
 #include <third_party/agg23/agg_conv_stroke.h>
@@ -469,16 +474,14 @@
 #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/containers/span.h>
 #include <third_party/base/debug/alias.h>
 #include <third_party/base/memory/aligned_memory.h>
+#include <third_party/base/memory/ptr_util.h>
 #include <third_party/base/no_destructor.h>
 #include <third_party/base/notreached.h>
 #include <third_party/base/numerics/safe_conversions.h>
 #include <third_party/base/numerics/safe_math.h>
-#include <third_party/base/ptr_util.h>
-#include <third_party/base/span.h>
-#include <third_party/skia_shared/SkFloatToDecimal.h>
 #endif // PCH_LEVEL >= 3
 #if PCH_LEVEL >= 4
 #endif // PCH_LEVEL >= 4
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index f1d3552b20d2..039505eda9cf 100644
--- a/external/pdfium/ubsan.patch
+++ b/external/pdfium/ubsan.patch
@@ -1,24 +1,3 @@
---- core/fxcrt/string_data_template.cpp
-+++ core/fxcrt/string_data_template.cpp
-@@ -73,7 +73,7 @@
-                                                 size_t nLen) {
-   DCHECK_GE(nLen, 0);
-   DCHECK_LE(nLen, m_nAllocLength);
--  memcpy(m_String, pStr, nLen * sizeof(CharType));
-+  if (nLen != 0) memcpy(m_String, pStr, nLen * sizeof(CharType));
-   m_String[nLen] = 0;
- }
- 
-@@ -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));
-   m_String[offset + nLen] = 0;
- }
- 
 --- core/fxge/cfx_glyphcache.cpp
 +++ core/fxge/cfx_glyphcache.cpp
 @@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> 
CFX_GlyphCache::RenderGlyph(

Reply via email to