download.lst                                          |    4 -
 external/poppler/UnpackedTarball_poppler.mk           |    1 
 external/poppler/gcc7-GfxFont.patch.1                 |    2 
 external/poppler/poppler-config.patch.1               |   14 +++---
 external/poppler/std_span.patch.1                     |   38 ++++++++++++++++++
 external/poppler/std_string.patch.1                   |   11 +++++
 include/o3tl/span.hxx                                 |   11 +++++
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |    5 ++
 8 files changed, 76 insertions(+), 10 deletions(-)

New commits:
commit 3c1ac1bd77689863797732b3736fd53f0e553cdb
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Jan 7 18:42:29 2025 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Jan 10 09:17:29 2025 +0100

    sdext: adapt xpdfwrapper to poppler 24.12
    
    Change-Id: Ia47edf2ac821e3ef5c40f7582253f894eac74060
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179902
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit aa94faf493945e854a888e809a9c5cc8d6d0b978)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179957
    Tested-by: Michael Stahl <[email protected]>
    (cherry picked from commit 052c9859e2bd5dfeb54d834a3d7910140d5a8535)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180039
    Tested-by: allotropia jenkins <[email protected]>

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 676aefe91859..b5e2873b3858 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -1020,7 +1020,12 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, 
Stream* str,
 
     int bitsPerComponent = 1;
     StreamColorSpaceMode csMode = streamCSNone;
+#if POPPLER_CHECK_VERSION(24, 12, 0)
+    bool hasAlpha;
+    str->getImageParams( &bitsPerComponent, &csMode, &hasAlpha );
+#else
     str->getImageParams( &bitsPerComponent, &csMode );
+#endif
     if( bitsPerComponent == 1 && (csMode == streamCSNone || csMode == 
streamCSDeviceGray) )
     {
         GfxRGB oneColor = { dblToCol( 1.0 ), dblToCol( 1.0 ), dblToCol( 1.0 ) 
};
commit 58d93d6e4334b750723767b751705e00b9dd510c
Author:     Taichi Haradaguchi <[email protected]>
AuthorDate: Fri Aug 9 05:50:39 2024 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Jan 10 09:17:24 2025 +0100

    poppler: upgrade to release 24.08.0
    
    Fixes CVE-2024-6239
    
    Downloaded from https://poppler.freedesktop.org/poppler-24.08.0.tar.xz
    
    Change-Id: I70373c367cc3da87d9847c00b02a17f514b52ae8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171667
    Tested-by: Jenkins
    Reviewed-by: Taichi Haradaguchi <[email protected]>
    (cherry picked from commit e266da95e0522fd9896f92f1c2ca3235e0e6fd66)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172951
    Reviewed-by: Xisco Fauli <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173040
    (cherry picked from commit e79a53b37d7157b7991eb27b3f440028ca06feea)
    (cherry picked from commit 8b4687eb81e8413469f4a968be2d4b2a279d5195)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180030
    Tested-by: allotropia jenkins <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/download.lst b/download.lst
index 7432ffd50c6b..07f70423dd15 100644
--- a/download.lst
+++ b/download.lst
@@ -470,8 +470,8 @@ LIBPNG_TARBALL := libpng-1.6.44.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-POPPLER_SHA256SUM := 
0cdabd495cada11f6ee9e75c793f80daf46367b66c25a63ee8c26d0f9ec40c76
-POPPLER_TARBALL := poppler-24.06.0.tar.xz
+POPPLER_SHA256SUM := 
97453fbddf0c9a9eafa0ea45ac710d3d49bcf23a62e864585385d3c0b4403174
+POPPLER_TARBALL := poppler-24.08.0.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/poppler/gcc7-GfxFont.patch.1 
b/external/poppler/gcc7-GfxFont.patch.1
index a240b1b8bad2..e73dbeb201c1 100644
--- a/external/poppler/gcc7-GfxFont.patch.1
+++ b/external/poppler/gcc7-GfxFont.patch.1
@@ -41,7 +41,7 @@ index cc2ce038..b0d0d610 100644
 @@ -668,7 +668,7 @@ std::optional<GfxFontLoc> GfxFont::locateFont(XRef *xref, 
PSOutputDev *ps)
          fontLoc.locType = gfxFontLocResident;
          fontLoc.fontType = fontType1;
-         fontLoc.path = *name;
+         fontLoc.path = name.value_or(std::string());
 -        return fontLoc;
 +        return std::move(fontLoc); // std::move only required to please g++-7
      }
diff --git a/external/poppler/std_span.patch.1 
b/external/poppler/std_span.patch.1
index 1ed550daa3a4..37516afd5f03 100644
--- a/external/poppler/std_span.patch.1
+++ b/external/poppler/std_span.patch.1
@@ -24,3 +24,15 @@ replace C++20 std::span with o3tl::span
  
  #include "CharTypes.h"
  #include "poppler_private_export.h"
+--- poppler/fofi/FoFiTrueType.h.orig   2025-01-09 14:58:33.689388042 +0100
++++ poppler/fofi/FoFiTrueType.h        2025-01-09 14:58:35.674394746 +0100
+@@ -35,7 +35,8 @@
+ #include <vector>
+ #include <unordered_map>
+ #include <string>
+-#include <span>
++#include <o3tl/span.hxx>
++namespace std { using o3tl::span; }
+ #include "FoFiBase.h"
+ #include "poppler_private_export.h"
+ 
diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx
index 6cf718a1a120..b7c9fc58389c 100644
--- a/include/o3tl/span.hxx
+++ b/include/o3tl/span.hxx
@@ -24,6 +24,7 @@ namespace o3tl { using std::span; }
 
 #include <cassert>
 #include <cstddef>
+#include <array>
 #include <iterator>
 #include <type_traits>
 #include <vector>
@@ -60,6 +61,10 @@ public:
         assert(a != nullptr || len == 0);
     }
 
+    template<typename T2, std::size_t Size>
+    constexpr span(const std::array<T2, Size>& arr)
+        : data_(const_cast<T*>(arr.data())), size_(arr.size()) {}
+
     template<typename T2>
     constexpr span(const std::vector<T2>& vec)
         : data_(const_cast<T*>(vec.data())), size_(vec.size()) {}
commit 2452c7182a839e793b6a6d99b2a0ae4b73429dde
Author:     Xisco Fauli <[email protected]>
AuthorDate: Mon Jun 10 16:49:29 2024 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Jan 10 09:17:20 2025 +0100

    poppler: Upgrade to 24.06.0
    
    Downloaded from https://poppler.freedesktop.org/poppler-24.06.0.tar.xz
    
    Change-Id: I6b679ae014edd7a9897eed39a6e91c63251cc016
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168642
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173039
    Reviewed-by: Taichi Haradaguchi <[email protected]>
    (cherry picked from commit cec9dd0f6f961f39072795c27ec90994587c5369)
    (cherry picked from commit 2728df128681088e579f38792248eb932b74f8b8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180011
    Tested-by: Michael Stahl <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/download.lst b/download.lst
index d71f89d89656..7432ffd50c6b 100644
--- a/download.lst
+++ b/download.lst
@@ -470,8 +470,8 @@ LIBPNG_TARBALL := libpng-1.6.44.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-POPPLER_SHA256SUM := 
d8c5eb30b50285ad9f0af8c6335cc2d3b9597fca475cbc2598a5479fa379f779
-POPPLER_TARBALL := poppler-24.05.0.tar.xz
+POPPLER_SHA256SUM := 
0cdabd495cada11f6ee9e75c793f80daf46367b66c25a63ee8c26d0f9ec40c76
+POPPLER_TARBALL := poppler-24.06.0.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/poppler/UnpackedTarball_poppler.mk 
b/external/poppler/UnpackedTarball_poppler.mk
index a3f493bb204f..382e2e0f1d5f 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\
        external/poppler/gcc7-GfxFont.patch.1 \
        external/poppler/std_charconv.patch.1 \
        external/poppler/std_string.patch.1 \
+       external/poppler/std_span.patch.1 \
        external/poppler/poppler-config.patch.1 \
 ))
 
diff --git a/external/poppler/poppler-config.patch.1 
b/external/poppler/poppler-config.patch.1
index 8f71e987b2b9..e2163319fd43 100644
--- a/external/poppler/poppler-config.patch.1
+++ b/external/poppler/poppler-config.patch.1
@@ -179,7 +179,7 @@ index 0fbd336a..451213f8 100644
 +#define PACKAGE_NAME "poppler"
 +
 +/* Define to the full name and version of this package. */
-+#define PACKAGE_STRING "poppler 23.09.0"
++#define PACKAGE_STRING "poppler 24.06.0"
 +
 +/* Define to the one symbol short name of this package. */
 +#define PACKAGE_TARNAME "poppler"
@@ -188,7 +188,7 @@ index 0fbd336a..451213f8 100644
 +#define PACKAGE_URL ""
 +
 +/* Define to the version of this package. */
-+#define PACKAGE_VERSION "23.09.0"
++#define PACKAGE_VERSION "24.06.0"
 +
 +/* Poppler data dir */
 +#define POPPLER_DATADIR "/usr/local/share/poppler"
@@ -206,7 +206,7 @@ index 0fbd336a..451213f8 100644
 +/* #undef USE_FLOAT */
 +
 +/* Version number of package */
-+#define VERSION "23.09.0"
++#define VERSION "24.06.0"
 +
 +#if defined(__APPLE__)
 +#elif defined (_WIN32)
@@ -290,7 +290,7 @@ index 0fbd336a..451213f8 100644
 +
 +/* Defines the poppler version. */
 +#ifndef POPPLER_VERSION
-+#define POPPLER_VERSION "23.09.0"
++#define POPPLER_VERSION "24.06.0"
 +#endif
 +
 +/* Use single precision arithmetic in the Splash backend */
@@ -437,9 +437,9 @@ index 0fbd336a..451213f8 100644
 +
 +#include "poppler-global.h"
 +
-+#define POPPLER_VERSION "23.09.0"
-+#define POPPLER_VERSION_MAJOR 23
-+#define POPPLER_VERSION_MINOR 9
++#define POPPLER_VERSION "24.06.0"
++#define POPPLER_VERSION_MAJOR 24
++#define POPPLER_VERSION_MINOR 6
 +#define POPPLER_VERSION_MICRO 0
 +
 +namespace poppler
diff --git a/external/poppler/std_span.patch.1 
b/external/poppler/std_span.patch.1
new file mode 100644
index 000000000000..1ed550daa3a4
--- /dev/null
+++ b/external/poppler/std_span.patch.1
@@ -0,0 +1,26 @@
+replace C++20 std::span with o3tl::span
+
+--- poppler/poppler/Stream.h.orig      2025-01-09 11:50:21.095027459 +0100
++++ poppler/poppler/Stream.h   2025-01-09 11:53:05.933540760 +0100
+@@ -47,7 +47,8 @@
+ #include <atomic>
+ #include <cstdio>
+ #include <vector>
+-#include <span>
++#include <o3tl/span.hxx>
++namespace std { using o3tl::span; }
+ 
+ #include "poppler-config.h"
+ #include "poppler_private_export.h"
+--- poppler/poppler/UTF.h.orig2        2025-01-09 11:48:18.197644776 +0100
++++ poppler/poppler/UTF.h      2025-01-09 11:53:11.688558686 +0100
+@@ -23,7 +23,8 @@
+ #include <climits>
+ #include <string>
+ #include <vector>
+-#include <span>
++#include <o3tl/span.hxx>
++namespace std { using o3tl::span; }
+ 
+ #include "CharTypes.h"
+ #include "poppler_private_export.h"
diff --git a/external/poppler/std_string.patch.1 
b/external/poppler/std_string.patch.1
index 6c5ce136ca47..02a7940b8e40 100644
--- a/external/poppler/std_string.patch.1
+++ b/external/poppler/std_string.patch.1
@@ -75,3 +75,14 @@ remove C++20 starts_with
              const Object fontObj = fontDict->getVal(i);
              if (fontObj.isDict() && fontObj.dictIs("Font")) {
                  const Object fontBaseFontObj = fontObj.dictLookup("BaseFont");
+--- poppler/poppler/PSOutputDev.cc.orig        2025-01-09 12:21:50.100540341 
+0100
++++ poppler/poppler/PSOutputDev.cc     2025-01-09 12:21:52.004545519 +0100
+@@ -7482,7 +7482,7 @@
+     //   for the keyword, which was emitted by the caller)
+     // - lines that start with a left paren are treated as <text>
+     //   instead of <textline>, so we escape a leading paren
+-    if (s.starts_with(unicodeByteOrderMark)) {
++    if (GooString::startsWith(s, unicodeByteOrderMark)) {
+         i = 3;
+         step = 2;
+     } else {
diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx
index cfe4c1ffa3a3..6cf718a1a120 100644
--- a/include/o3tl/span.hxx
+++ b/include/o3tl/span.hxx
@@ -35,6 +35,7 @@ namespace o3tl {
 template<typename T>
 class span {
 public:
+    using element_type = T;
     using value_type = T;
     using pointer = value_type *;
     using const_pointer = value_type const *;
@@ -61,7 +62,7 @@ public:
 
     template<typename T2>
     constexpr span(const std::vector<T2>& vec)
-        : data_(vec.data()), size_(vec.size()) {}
+        : data_(const_cast<T*>(vec.data())), size_(vec.size()) {}
 
     /** for assigning from span<T> to span<const T> */
     constexpr span (const span<typename std::remove_const<T>::type>& other) 
noexcept
commit a1959833b95c00afc8c16b2a4cffaf79c4890f0e
Author:     Luboš Luňák <[email protected]>
AuthorDate: Sun Oct 31 11:23:11 2021 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Jan 10 09:17:17 2025 +0100

    add o3tl::span ctor from std::vector
    
    Makes code simpler, and std::span can be constructed from std::vector
    too.
    
    [note: backport only contains o3tl::span changes]
    
    Change-Id: Iae26b53c52148c19d9068a63126a7393d098d654
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124507
    Reviewed-by: Noel Grandin <[email protected]>
    Reviewed-by: Luboš Luňák <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit b5e701d36ec16776e01597fd250dbde2e73fad3a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180010
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Michael Stahl <[email protected]>

diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx
index 087d1f9d69c3..cfe4c1ffa3a3 100644
--- a/include/o3tl/span.hxx
+++ b/include/o3tl/span.hxx
@@ -26,6 +26,7 @@ namespace o3tl { using std::span; }
 #include <cstddef>
 #include <iterator>
 #include <type_traits>
+#include <vector>
 
 namespace o3tl {
 
@@ -58,6 +59,10 @@ public:
         assert(a != nullptr || len == 0);
     }
 
+    template<typename T2>
+    constexpr span(const std::vector<T2>& vec)
+        : data_(vec.data()), size_(vec.size()) {}
+
     /** for assigning from span<T> to span<const T> */
     constexpr span (const span<typename std::remove_const<T>::type>& other) 
noexcept
         : data_(other.data()), size_(other.size()) {}

Reply via email to