Bug 151560 - Calc crashes when loading a previously saved document which has cells with "#" values
Summary: Calc crashes when loading a previously saved document which has cells with "#...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.6.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.6.0 target:7.5.3.2 target:7.4.7
Keywords:
Depends on:
Blocks: Crash
  Show dependency treegraph
 
Reported: 2022-10-16 09:00 UTC by ratatoeskr
Modified: 2023-05-03 10:19 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet that causes LibreOffice to crash when trying to open it (6.06 KB, application/vnd.oasis.opendocument.spreadsheet-flat-xml)
2022-10-16 09:02 UTC, ratatoeskr
Details
This file opens, but saving an opening again will crash LibreOffice (6.04 KB, application/vnd.oasis.opendocument.spreadsheet-flat-xml)
2022-10-16 10:02 UTC, ratatoeskr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ratatoeskr 2022-10-16 09:00:05 UTC
Description:
I edited a perfectly fine spreadsheet by removing a lot of stuff. Because of that, some references broke, causing some cells to have values like "#WERT!" or "NAME?" (using German locale). I saved this spreadsheet and closed LibreOffice. Later, I tried to open the spreadsheet again, but LibreOffice crashed. When starting from the terminal, the following error message is printed:

/usr/include/c++/12.2.0/optional:484: constexpr const _Tp& std::_Optional_base_impl<_Tp, _Dp>::_M_get() const [with _Tp = rtl::OUString; _Dp = std::_Optional_base<rtl::OUString, false, false>]: Assertion 'this->_M_is_engaged()' failed.

I cannot share the original document or the I edited due to sensitive data, but I used a text editor to remove stuff until I had a version of the document I could open again. When I open this skeleton document, save it, close LibreOffice and open the file again, the crash is back.

Calc can open the document again after replacing all "#" values with a text editor (removing the #).

Starting LibreOffice in safe-mode did not help.

Keywords: EDITING FILEOPEN FILESAVE

Steps to Reproduce:
1. Open the attached example spreadsheet. It should open fine.
2. Save the spreadsheet without editing anything.
3. Close LibreOffice.
4. Open the file again. LibreOffice crashes.
5. Use a text editor to remove all occurrences of the "#" symbol.
6. Open the file once more. It loads again.
7. When saving the spreadsheet again, LibreOffice is again unable to load it.

Actual Results:
LibreOffice crashes when loading a version of the spreadsheet that contains "#" cell values.

Expected Results:
LibreOffice openes the spreadsheet without crashing.


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Version: 7.3.6.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
7.3.6-3
Calc: CL

Running Arch Linux, LTS kernel 5.15.71-1
Comment 1 ratatoeskr 2022-10-16 09:02:45 UTC
Created attachment 183078 [details]
Spreadsheet that causes LibreOffice to crash when trying to open it
Comment 2 Mike Kaganski 2022-10-16 09:50:20 UTC
There are two problems here:

1. The crash. No matter what, the file should not crash the program; if validation fails, it must be rejected gracefully. You have provided the file to debug this.
2. Saving some invalid data. And that needs the file that opens normally, but generates the problematic file on save. You mentioned you generated such a file when preparing the test case. If possible, please also attach it here.

I confirm the crash with attachment 183078 [details] using Version: 7.4.2.3 (x64) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL
Comment 3 ratatoeskr 2022-10-16 10:02:56 UTC
Created attachment 183079 [details]
This file opens, but saving an opening again will crash LibreOffice

This file was derived from the attachment "corrupt.fods" by removing all "#" symbols.
Comment 4 Caolán McNamara 2023-04-17 08:25:26 UTC
lets at least not crash with this input
Comment 5 Commit Notification 2023-04-17 12:19:43 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/3fbb307b970f41605a80c6ea3cbea0c9af9eb638

tdf#151560 don't crash on loading dubious fods

It will be available in 7.4.7.

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 6 Commit Notification 2023-04-17 12:53:55 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/4ad3605166c91193b3dbf41ed33515e267133f90

tdf#151560 don't crash on loading dubious fods

It will be available in 7.5.4.

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 7 Commit Notification 2023-04-17 15:04:16 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7773932ba7c4bafeed7fba0a5d87f75eed09f850

tdf#151560 don't crash on loading dubious fods

It will be available in 7.6.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 8 Commit Notification 2023-04-26 11:20:03 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5-3":

https://git.libreoffice.org/core/commit/65572a7ae58b5eafba835b4c0cb16e3cb9188f05

tdf#151560 don't crash on loading dubious fods

It will be available in 7.5.3.

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.