From 4afd83245b6ab2232032c74b1d242122fc734352 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 14 Aug 2023 19:59:32 +0200 Subject: 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 --- 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(-) 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 CPDF_Metadata::CheckForSharedForm() const { +@@ -87,7 +87,7 @@ std::vector CPDF_Metadata::CheckForSharedForm() const { CFX_XMLParser parser(stream); std::unique_ptr doc = parser.Parse(); if (!doc) @@ -68,7 +68,7 @@ index 228a0c137..bf512beb3 100644 + return std::vector(); std::vector 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 #include #include +#include #include #include #include @@ -187,6 +188,7 @@ #include #include #include +#include #include #include #include @@ -283,8 +285,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -317,6 +318,7 @@ #include #include #include +#include #include #include #include @@ -337,7 +339,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -374,7 +379,6 @@ #include #include #include -#include #include #include #include @@ -455,6 +459,7 @@ #include #include #include +#include #include #include #include @@ -469,16 +474,14 @@ #include #include #include -#include +#include #include #include +#include #include #include #include #include -#include -#include -#include #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::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_GlyphCache::RenderGlyph( -- cgit