Bug 165433 - Opening PDF files fails with poppler 25.02.0
Summary: Opening PDF files fails with poppler 25.02.0
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
24.8.5.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL: https://gitlab.archlinux.org/archlinu...
Whiteboard: target:25.8.0 target:25.2.2 target:24...
Keywords: filter:pdf
: 165363 165469 (view as bug list)
Depends on:
Blocks: PDF-Import-Draw
  Show dependency treegraph
 
Reported: 2025-02-25 12:34 UTC by Robin Candau
Modified: 2025-03-03 08:37 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of the error (9.77 KB, image/png)
2025-02-25 12:34 UTC, Robin Candau
Details
Sample document to reproduce the issue (26.01 KB, application/pdf)
2025-02-25 12:49 UTC, Robin Candau
Details
Bug Reproduced on Fedora Rawhide (16.75 KB, image/png)
2025-02-26 10:57 UTC, Robin Candau
Details
Fedora Rawhide versions details (588.91 KB, image/png)
2025-02-26 10:58 UTC, Robin Candau
Details
Bug Reproduced on OpenSUSE Tumbleweed (34.33 KB, image/png)
2025-02-26 12:38 UTC, Robin Candau
Details
OpenSUSE Tumbleweed versions details (373.05 KB, image/png)
2025-02-26 12:38 UTC, Robin Candau
Details
output from "make verbose=True poppler" (353.20 KB, text/plain)
2025-02-26 19:44 UTC, Xisco Faulí
Details
Patch: Fix PDF import with system poppler >= 25.02 (678 bytes, patch)
2025-02-27 08:42 UTC, Robin Candau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Candau 2025-02-25 12:34:07 UTC
Description:
Hi,

With poppler 25.02.0, opening PDF files in LibreOffice (Writer) fails with:

```
General Error. 
General input/output error.
```

Screenshot here: https://pasteboard.co/W5s0NnuAhj25.png

Steps to Reproduce:
1. Build LibreOffice with poppler 25.02.0
2. Open a PDF file in LibreOffice Writer
3. See error

Actual Results:
```
General Error. 
General input/output error.
```

Expected Results:
PDF file opening as expected


Reproducible: Always


User Profile Reset: Yes

Additional Info:
This issue is affecting both `24.8.5.x` and `25.2.0.x` versions.

I wasn't able to generate more logs than the error in the description for the moment, sorry about that.

For cross-reference, this issue was reported on our side (Arch Linux) here: https://gitlab.archlinux.org/archlinux/packaging/packages/libreoffice-fresh/-/issues/6

I'm happy to provide any information that could help or test any patches :)
Comment 1 Robin Candau 2025-02-25 12:34:59 UTC
Created attachment 199437 [details]
Screenshot of the error
Comment 2 Xisco Faulí 2025-02-25 12:47:37 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Comment 3 Robin Candau 2025-02-25 12:49:46 UTC
Created attachment 199438 [details]
Sample document to reproduce the issue
Comment 4 Xisco Faulí 2025-02-25 12:52:24 UTC
not reproduced with poppler-25.01, testing with poppler-25.02...
Comment 5 V Stuart Foote 2025-02-25 12:52:47 UTC
confirmed as in bug 165363 and external downstream for LFS and arch linux.

Seems LO only up to poppler 25.01 for CVE-2024-56378 with https://gerrit.libreoffice.org/c/core/+/179903

and backport to 24.8 with
https://gerrit.libreoffice.org/c/core/+/179956
Comment 6 Robin Candau 2025-02-25 12:55:41 UTC
> not reproduced with poppler-25.01, testing with poppler-25.02...

@Xisco, yes sorry... I should have made clearer that this only happens with poppler-25.02.
Comment 7 Xisco Faulí 2025-02-25 12:58:01 UTC
(In reply to Robin Candau from comment #6)
> > not reproduced with poppler-25.01, testing with poppler-25.02...
> 
> @Xisco, yes sorry... I should have made clearer that this only happens with
> poppler-25.02.

then it looks like a poppler regression, isn't it ?
Comment 8 Xisco Faulí 2025-02-25 13:14:07 UTC
I can't reproduce the issue with LibreOffice master bf4fe0c2ba1d0a44cc07c6afba6d56b8adf8af50 using --without-system-poppler with https://gerrit.libreoffice.org/c/core/+/182169 on top. PDF file opens fine for me
Comment 9 V Stuart Foote 2025-02-25 13:23:22 UTC
*** Bug 165363 has been marked as a duplicate of this bug. ***
Comment 10 Xisco Faulí 2025-02-25 13:41:39 UTC
Hi Robin,
Is https://gitlab.archlinux.org/archlinux/packaging/packages/libreoffice-fresh/-/commit/070fd4f2f5d939e6d4f21f96dd15f306f526575d missing anything ? I'm surprised it works out of the box without tweaking any patch
Comment 11 Robin Candau 2025-02-25 13:47:08 UTC
(In reply to Xisco Faulí from comment #10)
> Hi Robin,
> Is
> https://gitlab.archlinux.org/archlinux/packaging/packages/libreoffice-fresh/-
> /commit/070fd4f2f5d939e6d4f21f96dd15f306f526575d missing anything ? I'm
> surprised it works out of the box without tweaking any patch

Hi,

It should not, I was able to rebuild the package against poppler 25.02.0 just now without issue nor requiring any additional tweaking.
Comment 12 Buovjaga 2025-02-25 17:39:08 UTC
I repro with the Arch-packaged version, but building master with --with-system-poppler, I can't repro.

Robin: can you repro with master?
Comment 13 Commit Notification 2025-02-25 19:15:20 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/12c1596b0fd152399bed90f3d26014a32efc24e3

related tdf#165433: poppler: upgrade to 25.02.0

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Xisco Faulí 2025-02-25 19:16:20 UTC
Internal poppler has been upgraded to 25.02.0 as well. No crash for me when building with --without-system-poppler. Testing from others is appreciated as well
Comment 15 codestation 2025-02-25 22:38:36 UTC
Same error in Archlinux with poppler 25.02.0

I also get a coredump with xpdfimport when the error happens

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff74a56d3 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
#2  0x00007ffff744bba0 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff7433582 in __GI_abort () at abort.c:73
#4  0x00007ffff7697b2c in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#5  0x00007ffff76ae3ba in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#6  0x00007ffff769752a in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#7  0x00007ffff76ae676 in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x7ffff7876d60 <typeinfo for std::logic_error>, dest=0x7ffff76c5a30 <std::logic_error::~logic_error()>)
    at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_throw.cc:98
#8  0x00007ffff769b2dd in std::__throw_logic_error (__s=0x5555555620a0 "basic_string: construction from null is not valid") at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/functexcept.cc:70
#9  0x0000555555557549 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> > () at /usr/include/c++/14.2.1/bits/basic_string.h:651
#10 0x000055555555812f in std::make_unique<GlobalParams, char const*&> () at /usr/include/c++/14.2.1/bits/unique_ptr.h:1077
#11 main (argc=-7792, argv=0xd6da) at /usr/src/debug/libreoffice-fresh/libreoffice-25.2.0.3/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx:127

Checking the source code changes from poppler 25.02.0 it seems that GlobalParams doesn't have  a constructor that accepts a nullptr anymore

https://fossies.org/diffs/poppler/25.01.0_vs_25.02.0/poppler/GlobalParams.h-diff.html
Comment 16 Robin Candau 2025-02-25 23:01:05 UTC
(In reply to Xisco Faulí from comment #14)
> Internal poppler has been upgraded to 25.02.0 as well. No crash for me when
> building with --without-system-poppler. Testing from others is appreciated
> as well

I backported the related patch (https://git.libreoffice.org/core/commit/12c1596b0fd152399bed90f3d26014a32efc24e3) into our LibreOffice package and built it with internal poppler 25.02.0 (using --without-system-poppler) for testing purposes. It built fine and I can open PDF files without issues. 

I'm confused... I guess that means there's either an issue with our poppler 25.02.0 build somehow, or the culprit is elsewhere?

(In reply to Buovjaga from comment #12)
> I repro with the Arch-packaged version, but building master with
> --with-system-poppler, I can't repro.
> 
> Robin: can you repro with master?

Given the above result, I guess the issue is elsewhere. But I'll still try to give master a go tomorrow, just in case.
Comment 17 Buovjaga 2025-02-26 05:37:12 UTC
(In reply to Robin Candau from comment #16)
> (In reply to Xisco Faulí from comment #14)
> > Internal poppler has been upgraded to 25.02.0 as well. No crash for me when
> > building with --without-system-poppler. Testing from others is appreciated
> > as well
> 
> I backported the related patch
> (https://git.libreoffice.org/core/commit/
> 12c1596b0fd152399bed90f3d26014a32efc24e3) into our LibreOffice package and
> built it with internal poppler 25.02.0 (using --without-system-poppler) for
> testing purposes. It built fine and I can open PDF files without issues. 
> 
> I'm confused... I guess that means there's either an issue with our poppler
> 25.02.0 build somehow, or the culprit is elsewhere?

The only difference seems to be external/poppler/disable-freetype.patch.1
Comment 18 Robin Candau 2025-02-26 10:57:22 UTC
I was able to reproduce this issue on Fedora (Rawhide) using their LibreOffice package (25.2.0), which is built with their poppler (25.02.0) system package (not LibreOffice's internal poppler), as we do at Arch Linux.

See screenshots here with full versions details: https://postimg.cc/gallery/rdz0Bbk (I'll upload them as attachments as well).

That means this issue is not specific to our poppler build (nor to Arch Linux overall) after all.
Comment 19 Robin Candau 2025-02-26 10:57:57 UTC
Created attachment 199463 [details]
Bug Reproduced on Fedora Rawhide
Comment 20 Robin Candau 2025-02-26 10:58:23 UTC
Created attachment 199464 [details]
Fedora Rawhide versions details
Comment 21 Robin Candau 2025-02-26 12:37:37 UTC
(In reply to Robin Candau from comment #18)
> I was able to reproduce this issue on Fedora (Rawhide) using their
> LibreOffice package (25.2.0), which is built with their poppler (25.02.0)
> system package (not LibreOffice's internal poppler), as we do at Arch Linux.
> 
> See screenshots here with full versions details:
> https://postimg.cc/gallery/rdz0Bbk (I'll upload them as attachments as well).
> 
> That means this issue is not specific to our poppler build (nor to Arch
> Linux overall) after all.

This issue also happens on OpenSUSE (Tumbleweed) (see https://postimg.cc/gallery/pLCcYKR or screenshots in attachments), so this definitely seems to affect every LibreOffice builds / packages compiled with system poppler 25.02.0.
Comment 22 Robin Candau 2025-02-26 12:38:15 UTC
Created attachment 199465 [details]
Bug Reproduced on OpenSUSE Tumbleweed
Comment 23 Robin Candau 2025-02-26 12:38:36 UTC
Created attachment 199466 [details]
OpenSUSE Tumbleweed versions details
Comment 24 Robin Candau 2025-02-26 12:53:14 UTC
(In reply to Buovjaga from comment #17)
> (In reply to Robin Candau from comment #16)
> > (In reply to Xisco Faulí from comment #14)
> > > Internal poppler has been upgraded to 25.02.0 as well. No crash for me when
> > > building with --without-system-poppler. Testing from others is appreciated
> > > as well
> > 
> > I backported the related patch
> > (https://git.libreoffice.org/core/commit/
> > 12c1596b0fd152399bed90f3d26014a32efc24e3) into our LibreOffice package and
> > built it with internal poppler 25.02.0 (using --without-system-poppler) for
> > testing purposes. It built fine and I can open PDF files without issues. 
> > 
> > I'm confused... I guess that means there's either an issue with our poppler
> > 25.02.0 build somehow, or the culprit is elsewhere?
> 
> The only difference seems to be external/poppler/disable-freetype.patch.1

Given that the bug is reproducible on other distributions shipping poppler 25.02.0 and building their LibreOffice package against it (rather than with the LO internal version), I agree that there might be a difference somewhere between the system poppler build shipped by said distributions and the LO internal one (most likely some patching done on the LO side?).

This "disable-freetype.patch.1" could be it. However:

1 - Applying it to our poppler package results in a failed build, so I need to investigate what's missing from it for us to test that.
2 - Regardless, disabling freetype support altogether in our poppler build is most likely not desirable for us..
Comment 25 Robin Candau 2025-02-26 14:24:17 UTC
(In reply to Buovjaga from comment #12)
> I repro with the Arch-packaged version, but building master with
> --with-system-poppler, I can't repro.
> 
> Robin: can you repro with master?

Yes I can.
I rebuilt our LibreOffice package with sources pointing to a clone of the master branch (built with system poppler) and I still face the same issue.

```
$ libreoffice --version
LibreOffice 25.8.0.0.alpha0 7dddb827c921fc2b5cdca899c66417cda1822db6
```
Comment 26 Andreas Radke 2025-02-26 14:50:04 UTC
What compiler flags does LibreOffice use when compiling internal poppler. Maybe we're hitting some compile or link time optimisation bug.
Comment 27 Xisco Faulí 2025-02-26 19:44:00 UTC
Created attachment 199476 [details]
output from "make verbose=True poppler"
Comment 28 Xisco Faulí 2025-02-26 19:47:55 UTC
(In reply to Xisco Faulí from comment #27)
> Created attachment 199476 [details]
> output from "make verbose=True poppler"

I attached the output from make verbose=True poppler.
It's done in https://opengrok.libreoffice.org/xref/core/external/poppler/Module_poppler.mk We apply some patches on top in https://opengrok.libreoffice.org/xref/core/external/poppler/UnpackedTarball_poppler.mk and create the static library in https://opengrok.libreoffice.org/xref/core/external/poppler/StaticLibrary_poppler.mk
Comment 29 V Stuart Foote 2025-02-26 21:47:29 UTC
*** Bug 165469 has been marked as a duplicate of this bug. ***
Comment 30 Robin Candau 2025-02-27 08:42:43 UTC
Created attachment 199496 [details]
Patch: Fix PDF import with system poppler >= 25.02
Comment 32 Robin Candau 2025-02-27 08:54:00 UTC
We were able to fix the issue.

The culprit is https://git.libreoffice.org/core/+/refs/heads/master/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx#112

Indeed, as pointed by codestation (https://bugs.documentfoundation.org/show_bug.cgi?id=165433#c15), since poppler 25.02.0, GlobalParams doesn't have a constructor that accepts a nullptr anymore (see https://gitlab.freedesktop.org/poppler/poppler/-/commit/b50390f748b59cb0a64b912636ecf6527bd0d12a).

As such, the data directory location defined for SYSTEM_POPPLER have to be updated accordingly (if SYSTEM_POPPLER >= 25.02.0).

Here is the patch we applied (also available in the attachments):

```
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index ebed12070..9b63559be 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -110,7 +110,11 @@ int main(int argc, char **argv)
 
     /* Get data directory location */
 #ifdef SYSTEM_POPPLER
+#if POPPLER_CHECK_VERSION(25, 0, 2)
+    const std::string datadir = "";
+#else
     const char* datadir = nullptr;
+#endif
 #else
     /* Creates an absolute path to the poppler_data directory, by taking the path
      * to the xpdfimport executable (provided in argv[0], and concatenating a
```
Comment 33 Robin Candau 2025-02-27 08:55:33 UTC
(In reply to Buovjaga from comment #31)
> (In reply to Robin Candau from comment #30)
> > Created attachment 199496 [details]
> > Patch: Fix PDF import with system poppler >= 25.02
> 
> Thanks for the patch. Would you like to submit it?
> 
> https://wiki.documentfoundation.org/Development/gerrit/setup
> https://wiki.documentfoundation.org/Development/gerrit/
> SubmitPatch#Submit_a_patch_for_review_with_gerrit
> https://wiki.documentfoundation.org/Development/GetInvolved#4.
> _Submit_the_patch

Sure!
Comment 34 Robin Candau 2025-02-27 09:46:14 UTC
(In reply to Buovjaga from comment #31)
> (In reply to Robin Candau from comment #30)
> > Created attachment 199496 [details]
> > Patch: Fix PDF import with system poppler >= 25.02
> 
> Thanks for the patch. Would you like to submit it?
> 
> https://wiki.documentfoundation.org/Development/gerrit/setup
> https://wiki.documentfoundation.org/Development/gerrit/
> SubmitPatch#Submit_a_patch_for_review_with_gerrit
> https://wiki.documentfoundation.org/Development/GetInvolved#4.
> _Submit_the_patch

Patch submitted: https://gerrit.libreoffice.org/c/core/+/182282
Comment 35 Commit Notification 2025-02-27 13:48:44 UTC
Robin Candau committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/406afe11711df9fcabbc829fcff00aef2f44c1d9

tdf#165433 Fix PDF imports with (system) poppler >= 25.02.0

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 36 V Stuart Foote 2025-02-27 14:36:18 UTC
Looking at https://cgit.freedesktop.org/poppler/poppler/commit/?id=b50390f748b59cb0a64b912636ecf6527bd0d12a  

But for what its worth, no impact with filter import on opening a PDF with the LibreOffice Community *Windows* builds that now build with poppler 25.02.0

2025-02-26 nightly with 12c1596b0fd152399bed90f3d26014a32efc24e3
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 12c1596b0fd152399bed90f3d26014a32efc24e3
CPU threads: 8; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 37 Commit Notification 2025-02-27 15:37:03 UTC
Robin Candau committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/6a442575b7e802d1a3c4c4c18cd59a66d87a9217

tdf#165433 Fix PDF imports with (system) poppler >= 25.02.0

It will be available in 25.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 38 Commit Notification 2025-02-27 15:37:07 UTC
Robin Candau committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/c680052f44c394d037cdddcde54f795a8b2a51b4

tdf#165433 Fix PDF imports with (system) poppler >= 25.02.0

It will be available in 24.8.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 39 Xisco Faulí 2025-03-03 08:34:50 UTC
Hi Robin,
Should this issue be closed now ?
Comment 40 Robin Candau 2025-03-03 08:37:00 UTC
(In reply to Xisco Faulí from comment #39)
> Hi Robin,
> Should this issue be closed now ?

Hi Xisco,

Yes! Sorry 0:)  
I marked it as "resolved" ;)