Bug 168979 - It crashes when I try to open a file
Summary: It crashes when I try to open a file
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0 target:25.8.4 target:25...
Keywords:
Depends on:
Blocks: Conditional-Formatting Crash
  Show dependency treegraph
 
Reported: 2025-10-21 08:16 UTC by ihowk
Modified: 2025-10-25 07:20 UTC (History)
3 users (show)

See Also:
Crash report or crash signature: ["https://crashreport.libreoffice.org/stats/signature/static%20double%20%60anonymous%20namespace'::GetPercentile(const%20class%20std::vector%3Cdouble,std::allocator%3Cdouble%3E%20%3E%20&%20const,%20double)"]


Attachments
This is the file that cannot be opened. (64.29 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-10-21 11:55 UTC, ihowk
Details
dmp file (494.98 KB, application/vnd.tcpdump.pcap)
2025-10-21 17:09 UTC, BogdanB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ihowk 2025-10-21 08:16:23 UTC
Description:
When I try to open an .ods file, the system crashes and I can't open it. No matter how many times I try to open it, the same problem occurs again and again.

Steps to Reproduce:
1.Trying to open a specific .ods file.

Actual Results:
system crashes.

Expected Results:
You can open, view, and edit files.


Reproducible: Always


User Profile Reset: No

Additional Info:
The crash started after I applied both color scale and data bar conditional formatting to a single page in a file.
The file causing the crash contains personal information and cannot be edited, so I cannot attach it. Please let me know if there is an alternative solution.
Comment 1 BogdanB 2025-10-21 08:25:22 UTC
Can you create a simple file with some random data, and to try to test if you can reproduce the bug on that file. In this case, if you succed attach the file to this bug report, clicking on Add an attachement.
Comment 2 Xisco Faulí 2025-10-21 09:32:30 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 ihowk 2025-10-21 11:55:16 UTC
Created attachment 203469 [details]
This is the file that cannot be opened.

I have attached a file that I cannot open. Please check it.
Comment 4 ihowk 2025-10-21 12:06:22 UTC
Addendum: I think the cause may be seat E.
Comment 5 Xisco Faulí 2025-10-21 12:09:01 UTC
Reproduced in

Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 81321560f2151ee12be26135aed65968287d1c94
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

and in

Version: 6.4.0.0.alpha1+
Build ID: 9bc848cf0d301aa57eabcffa101a1cf87bad6470
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3; 
Locale: es-ES (es_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 6 BogdanB 2025-10-21 17:09:09 UTC
Created attachment 203474 [details]
dmp file

warn:vcl.app:49194:49194:vcl/source/app/UserResourceScanner.cxx:51: Could not determine status for file 'file:///home/bogdan/.config/libreofficedev/4/user/themes'.
soffice.bin: /home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sc/source/core/data/colorscale.cxx:612: double {anonymous}::GetPercentile(const std::__debug::vector<double>&, double): Assertion `!rArray.empty()' failed.
warn:desktop:49194:49194:desktop/source/app/crashreport.cxx:62: minidump generated: /home/bogdan/.config/libreofficedev/4/crash//5c7ee3db-b97a-4133-10ee9183-9994b7eb.dmp
warn:legacy.tools:49194:49194:svx/source/form/fmvwimp.cxx:436: FmXFormView::~FmXFormView: Window list not empty!

from a debug build.
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8ffeca7af4302da21d33494342017c3737d540e1
CPU threads: 16; OS: Linux 6.14; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 7 Julien Nabet 2025-10-21 20:59:40 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

I had 2 bts:
#4  0x00007f1b78c32420 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=617, function=<optimized out>) at ./assert/assert.c:118
#5  0x00007f1b36486dcd in (anonymous namespace)::GetPercentile (rArray=std::__debug::vector of length 0, capacity 0, fPercentile=0.98499999999999999)
    at /home/julien/lo/libreoffice/sc/source/core/data/colorscale.cxx:617
#6  0x00007f1b3648897c in ScDataBarFormat::getMax (this=0x55fbd19ab750, nMin=0, nMax=0) at /home/julien/lo/libreoffice/sc/source/core/data/colorscale.cxx:946
#7  0x00007f1b36488aa6 in ScDataBarFormat::GetDataBarInfo (this=0x55fbd19ab750, rAddr=...) at /home/julien/lo/libreoffice/sc/source/core/data/colorscale.cxx:967
#8  0x00007f1b364a523f in ScConditionalFormat::GetData (this=0x55fbd19ab7f0, rCell=..., rPos=...) at /home/julien/lo/libreoffice/sc/source/core/data/conditio.cxx:1908
#9  0x00007f1b367e53b7 in (anonymous namespace)::handleConditionalFormat
    (rCondFormList=..., rCondFormats=..., pInfo=0x55fbd76c58f8, pTableInfo=0x7ffd2290b5d8, pStlPool=0x55fbd06a2fc0, rAddr=..., bHidden=@0x7ffd2290adf7: false, bHideFormula=@0x7ffd2290adf6: false, bTabProtect=false) at /home/julien/lo/libreoffice/sc/source/core/data/fillinfo.cxx:292

#4  0x00007feabbe32420 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=617, function=<optimized out>) at ./assert/assert.c:118
#5  0x00007fea7dc86dcd in (anonymous namespace)::GetPercentile (rArray=std::__debug::vector of length 0, capacity 0, fPercentile=0.98499999999999999)
    at /home/julien/lo/libreoffice/sc/source/core/data/colorscale.cxx:617
#6  0x00007fea7dc86d3b in ScColorScaleFormat::CalcValue (this=0x56208e45ccf0, nMin=0, nMax=0, itr=std::unique_ptr<ScColorScaleEntry> = {...})
    at /home/julien/lo/libreoffice/sc/source/core/data/colorscale.cxx:659
#7  0x00007fea7dc87357 in ScColorScaleFormat::GetColor (this=0x56208e45ccf0, rAddr=...) at /home/julien/lo/libreoffice/sc/source/core/data/colorscale.cxx:694
#8  0x00007fea7dca51bf in ScConditionalFormat::GetData (this=0x56208e4b4f60, rCell=..., rPos=...) at /home/julien/lo/libreoffice/sc/source/core/data/conditio.cxx:1903
#9  0x00007fea7dfe53c7 in (anonymous namespace)::handleConditionalFormat
    (rCondFormList=..., rCondFormats=..., pInfo=0x562094708190, pTableInfo=0x7ffc4bc97d48, pStlPool=0x56208d700280, rAddr=..., bHidden=@0x7ffc4bc97567: false, bHideFormula=@0x7ffc4bc97566: false, bTabProtect=false) at /home/julien/lo/libreoffice/sc/source/core/data/fillinfo.cxx:292


With this patch, I could open the file:
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 5891c10566f1..9f4dfdf9918c 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -656,8 +656,10 @@ double ScColorScaleFormat::CalcValue(double nMin, double nMax, const ScColorScal
             else
             {
                 double fPercentile = (*itr)->GetValue()/100.0;
-                return GetPercentile(rValues, fPercentile);
+                if (!rValues.empty())
+                    return GetPercentile(rValues, fPercentile);
             }
+            break;
         }
 
         default:
@@ -943,7 +945,9 @@ double ScDataBarFormat::getMax(double nMin, double nMax) const
         {
             double fPercentile = mpFormatData->mpUpperLimit->GetValue()/100.0;
             std::vector<double>& rValues = getValues();
-            return GetPercentile(rValues, fPercentile);
+            if (!rValues.empty())
+                return GetPercentile(rValues, fPercentile);
+            break;
         }
 
         default:

As always, perhaps I didn't really fix the root pb.
Comment 8 Commit Notification 2025-10-22 12:06:01 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

tdf#168979 survive broken color percentile scales

It will be available in 26.2.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 9 Commit Notification 2025-10-22 13:37:17 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

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

tdf#168979 survive broken color percentile scales

It will be available in 25.8.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 10 Commit Notification 2025-10-22 15:14:32 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/9c053a2221480acd2e9c1c87dc8fe58c40d84f29

tdf#168979 survive broken color percentile scales

It will be available in 25.2.8.

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 11 Commit Notification 2025-10-22 18:33:06 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1d927f761e4d5b1e28c7c11fe45f08b214ee93fa

tdf#168979: sc_subsequent_filters_test3: Add test

It will be available in 26.2.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 12 Julien Nabet 2025-10-23 08:26:28 UTC
On pc Debian x86-64 with master sources updated today (so with Caolán's patch), I confirm it works.
Thank you Caolán!
Comment 13 Commit Notification 2025-10-24 13:21:57 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-25-2-7":

https://git.libreoffice.org/core/commit/83420a216e67df63d8d5ed988fc4e3a5b3aba86c

tdf#168979 survive broken color percentile scales

It will be available in 25.2.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 14 ihowk 2025-10-24 13:46:11 UTC
After applying the patch, I was able to open the file!
There don't seem to be any particular problems at the moment.
Thank you for your assistance! I'll let you know if I find anything else.
Comment 15 Julien Nabet 2025-10-24 16:41:08 UTC
Thank you ihowk@yahoo.co.jp for your feedback, let's put this one to VERIFIED then.