summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-19 12:51:52 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-19 21:26:25 +0100
commit3746195ff989a4596afc456d53010d8860bd7b64 (patch)
treec6f0394cc26d99429f2cb64d7210f45487cb2fd5 /sc
parent08c04a589ad87274647e7bdb76957d5285eca116 (diff)
catch invalid ranges at export
log failure and continue to export the remainder of the document #0 0x0000733dda8ae4a1 in __cxa_throw () from target:/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x0000733dc5d0bd43 in ScCellRangeObj::getCellRangeByPosition (this=0x2a753d60, nLeft=43, nTop=-7, nRight=43, nBottom=-7) at sc/source/ui/unoobj/cellsuno.cxx:4638 #2 0x0000733dc66150d5 in ScTableSheetObj::getCellRangeByPosition (this=0x2a753d60, nLeft=43, nTop=-7, nRight=43, nBottom=-7) at sc/source/ui/unoobj/cellsuno.cxx:6711 #3 0x0000733dc62d3e38 in ScXMLExport::GetMerged (this=0x1fc74160, pCellAddress=<optimized out>, xTable=...) at sc/source/filter/xml/xmlexprt.cxx:2750 #4 0x0000733dc62d7104 in ScXMLExport::AddStyleFromCells (this=0x1fc74160, xProperties=..., xTable=..., nTable=0, pOldName=0x0) at sc/source/filter/xml/xmlexprt.cxx:2156 #5 0x0000733dc62dfebb in ScXMLExport::collectAutoStyles (this=<optimized out>) at sc/source/filter/xml/xmlexprt.cxx:2559 #6 0x0000733dc62d0fff in ScXMLExport::ExportAutoStyles_ (this=0x1fc74160) at sc/source/filter/xml/xmlexprt.cxx:2657 #7 0x0000733dd833a7a4 in SvXMLExport::ImplExportAutoStyles (this=0x1fc74160) at xmloff/source/core/xmlexp.cxx:1123 #8 0x0000733dd833d098 in SvXMLExport::exportDoc (this=0x1fc74160, eClass=<optimized out>) at xmloff/source/core/xmlexp.cxx:1389 #9 0x0000733dd83386f6 in SvXMLExport::filter (this=this@entry=0x1fc74160, aDescriptor=...) at xmloff/source/core/xmlexp.cxx:815 #10 0x0000733dc62e6452 in ScXMLExport::filter (this=0x1fc74160, aDescriptor=...) at sc/source/filter/xml/xmlexprt.cxx:5472 #11 0x0000733dc63204a0 in ScXMLImportWrapper::ExportToComponent (this=0x7ffc11959890, xContext=..., xModel=..., xWriter=..., aDescriptor=..., sName=..., sMediaType=..., sComponentName=..., aArgs=..., pSharedData=...) at sc/source/filter/xml/xmlwrap.cxx:707 #12 0x0000733dc632679a in ScXMLImportWrapper::Export (this=this@entry=0x7ffc11959890, bStylesOnly=bStylesOnly@entry=false) at sc/source/filter/xml/xmlwrap.cxx:943 #13 0x0000733dc6465d5e in ScDocShell::SaveXML (this=0x11d1c440, pSaveMedium=0x138252f0, xStor=...) at sc/source/ui/docshell/docsh.cxx:653 #14 0x0000733dc646a519 in ScDocShell::SaveAs (this=0x11d1c440, rMedium=...) at sc/source/ui/docshell/docsh.cxx:1913 #15 0x0000733dd6ae7432 in SfxObjectShell::SaveAsOwnFormat (this=0x11d1c440, rMedium=...) at sfx2/source/doc/objstor.cxx:3378 #16 0x0000733dd6af0ae6 in SfxObjectShell::SaveTo_Impl (this=0x11d1c440, rMedium=..., pSet=0x7ffc11959fe0) at sfx2/source/doc/objstor.cxx:1520 #17 0x0000733dd6af2f08 in SfxObjectShell::DoSave_Impl (this=0x11d1c440, pArgs=0x7ffc11959fe0) at sfx2/source/doc/objstor.cxx:2760 #18 0x0000733dd6b2b3aa in SfxBaseModel::storeSelf (this=0x5348c30, aSeqArgs=...) at /opt/rh/devtoolset-12/root/usr/include/c++/12/optional:306 #19 0x0000733dd6ab2671 in SfxStoringHelper::GUIStoreModel (this=this@entry=0x2ba275b0, xModel=..., aSlotName=..., aArgsSequence=..., bPreselectPassword=bPreselectPassword@entry=false, nDocumentSignatureState=SignatureState::NOSIGNATURES, bIsAsync=false) perhaps some relation to https://gerrit.libreoffice.org/c/core/+/160363 which is a somewhat similar situation Change-Id: I6b28ef0e9df0f44641fa5c582b5827dbcfb4af8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176765 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176792 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 2ca445ba2a1f..0b7646bbc583 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2729,6 +2729,20 @@ void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > const
}
}
+static uno::Reference<sheet::XSheetCellRange> lclGetSheetRange(const uno::Reference <sheet::XSpreadsheet>& xTable, sal_Int32 nCol, sal_Int32 nRow)
+{
+ try
+ {
+ return uno::Reference<sheet::XSheetCellRange>(xTable->getCellRangeByPosition(nCol, nRow, nCol, nRow), uno::UNO_QUERY);
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("sc", "Exception in getCellRangeByPosition, col: " << nCol << ", row: " << nRow);
+ assert(false && "try and capture this in crashtesting");
+ }
+ return nullptr;
+}
+
bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress,
const uno::Reference <sheet::XSpreadsheet>& xTable)
{
@@ -2740,7 +2754,7 @@ bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress,
bool bRowInc(nEndRow > nRow);
while(!bReady && nRow <= nEndRow && nCol <= nEndCol)
{
- uno::Reference<sheet::XSheetCellRange> xSheetCellRange(xTable->getCellRangeByPosition(nCol, nRow, nCol, nRow), uno::UNO_QUERY);
+ uno::Reference<sheet::XSheetCellRange> xSheetCellRange(lclGetSheetRange(xTable, nCol, nRow));
if (xSheetCellRange.is())
{
uno::Reference<sheet::XSheetCellCursor> xCursor(xTable->createCursorByRange(xSheetCellRange));