external: update pdfium to 4137

Change-Id: Ib7c12461e04fa97bf55ee967e8d6c9bcf92fdf4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94078
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/download.lst b/download.lst
index 7ad6e64..88a723c 100644
--- a/download.lst
+++ b/download.lst
@@ -210,8 +210,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 := 98e3a4ddcd522fb4cebf18a7dfd0e47877e9d33e957ff47b65cb952edc89618f
export PDFIUM_TARBALL := pdfium-4083.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 8a77900..25bbfa1 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -228,7 +228,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 \
@@ -414,6 +414,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
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 729d87f..16544f0 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -37,17 +37,3 @@ index 0fb627ba8..dda1fc8bc 100644
       : span(container.data(), container.size()) {}
   template <
       typename Container,
--- a/core/fxcrt/fx_memory_wrappers.h.orig	2020-01-15 11:16:03.848760100 +0100
+++ b/core/fxcrt/fx_memory_wrappers.h	2020-01-15 11:16:44.050531200 +0100
@@ -23,8 +23,11 @@
 template <class T>
 struct FxAllocAllocator {
  public:
+#ifndef _WIN32
+  // MSVC thinks uint8_t is not an arithmetic type.
   static_assert(std::is_arithmetic<T>::value,
                 "Only numeric types allowed in this partition");
+#endif
 
   using value_type = T;
   using pointer = T*;
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index ae5041e8..f1bb32e 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 2020-03-11 14:44:55 using:
 Generated on 2020-05-06 11:57:12 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:
@@ -178,7 +178,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/render/cpdf_charposlist.h>
#include <core/fpdfapi/render/charposlist.h>
#include <core/fpdfapi/render/cpdf_devicebuffer.h>
#include <core/fpdfapi/render/cpdf_docrenderdata.h>
#include <core/fpdfapi/render/cpdf_imagecacheentry.h>
@@ -320,6 +320,7 @@
#include <core/fxcrt/observed_ptr.h>
#include <core/fxcrt/pauseindicator_iface.h>
#include <core/fxcrt/retain_ptr.h>
#include <core/fxcrt/string_data_template.h>
#include <core/fxcrt/string_pool_template.h>
#include <core/fxcrt/unowned_ptr.h>
#include <core/fxcrt/widestring.h>
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index 1d03c28..8610e24f 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/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index dc4c089..2d15d03 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -69,10 +69,10 @@
                    "type": "shell"
                },
                {
                    "url": "https://dev-www.libreoffice.org/src/pdfium-4083.tar.bz2",
                    "sha256": "98e3a4ddcd522fb4cebf18a7dfd0e47877e9d33e957ff47b65cb952edc89618f",
                    "url": "https://dev-www.libreoffice.org/src/pdfium-4137.tar.bz2",
                    "sha256": "9a2f9bddca935a263f06c81003483473a525ccd0f4e517bc75fceb914d4c54b6",
                    "type": "file",
                    "dest-filename": "external/tarballs/pdfium-4083.tar.bz2"
                    "dest-filename": "external/tarballs/pdfium-4137.tar.bz2"
                },
                {
                    "url": "https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz",