Bug 163960 - LibreOffice crashes with std::bad_alloc error when opening a document
Summary: LibreOffice crashes with std::bad_alloc error when opening a document
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.8.3.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Crash
  Show dependency treegraph
 
Reported: 2024-11-19 14:17 UTC by linuxuser
Modified: 2025-03-05 21:18 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description linuxuser 2024-11-19 14:17:49 UTC
Description:
Start Libreoffice by typing command
libreroffice
to Bash. Click some docx-file. The result is a crash with box "Libreoffice 24.8 Document Recovery". Bash command line got the text
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc


Steps to Reproduce:
Start Libreoffice by typing command
libreroffice
to Bash. Click some docx-file. The result is a crash with box "Libreoffice 24.8 Document Recovery". Bash command line got the text
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Actual Results:
crash

Expected Results:
no crash


Reproducible: Always


User Profile Reset: No

Additional Info:
LibreOffice 24.8.3.2 480(Build:2)

Linux username-Lenovo-ideapad-L340-17IWL 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

No LSB modules are available.
Distributor ID:	Linuxmint
Description:	Linux Mint 21.3
Release:	21.3
Codename:	virginia
Comment 1 raal 2024-11-19 16:15:59 UTC
Hello,

Thank you for filing the bug. For the test, could you rename your LibreOffice directory profile (see https://wiki.documentfoundation.org/UserProfile)  or run LibreOffice in safe mode (https://help.libreoffice.org/7.2/en-US/text/shared/01/profile_safe_mode.html) and give it a new try? Thank you
Comment 2 linuxuser 2024-11-19 17:46:06 UTC
I started in a safe mode and there is no crash. However, I couldn't select the document I tried in non-safe mode.

The option Help/Restart in Safe Mode is disabled.

How do I rename my LibreOffice directory profile /home/jaakko/.config/libreoffice/4/user ?
Comment 3 Callegar 2025-03-05 20:20:02 UTC
Also seeing this with 24.8.5.2 (arch/manjaro build) on KDE, while opening a spreadsheet, using a profile that was OK with 24.2.x.

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Unspecified Application Error
Comment 4 Callegar 2025-03-05 21:10:03 UTC
I think that I have triaged the issue (at least for my case).

The problem occurs when I start libreoffice from a shell in which a python virtual environment is active.

This explains why:
- you do not see the issue when using the upstream binaries that embed their own Python environment
- you (initially) do not see the issue when starting in safe mode, since all the extensions, including those using Python, are disabled.

Probably, the libreoffice script that sets the environment before launching the soffice.bin executable, should also perform some check on virtual envs, to prevent this issue.
Comment 5 Callegar 2025-03-05 21:18:03 UTC
More checks reveal that the issue occurs if the bin directory of the virtual environment is on the path.