Created attachment 123858 [details]
Calc file with macro demonstrating bug
LibreOffice will crash if a cell range search is attempted on an empty range as returned by "queryContentCells" on a cell range with no data. A sample Calc file with a demonstration macro is attached.
Click "Crash" on the toolbar to demonstrate the bug. On a sheet with data, the row number containing the data is returned and displayed in a message box. The search is then done on an empty sheet and LibreOffice will crash.
Created attachment 123861 [details]
On pc Debian x86-64 with master sources updated today, I could reproduce this.
I attached a bt with symbols.
Eike: with this straightforward patch,
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 2e262b4..5b9cd4b 100644
@@ -3974,7 +3974,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
pLastPos->GetVars( nCol, nRow, nTab );
+ else if (!aRanges.empty())
nTab = lcl_FirstTab(aRanges); //! mehrere Tabellen?
ScDocument::GetSearchAndReplaceStart( *pSearchItem, nCol, nRow );
I got no crash but got a popup with this instead:
"Inadmissible value or data type.
Index out of defined range.
Is it normal or is the patch wrong or insufficient?
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":
Resolves: tdf#98895 range search crashes open office if range is null
It will be available in 5.2.0.
The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Might as well go brute force with an exception I reckon