sc/source/filter/xml/xmlexprt.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit b36a8a532b3ee6521d80277cb32a6936c0b09320
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Dec 7 12:30:37 2023 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Dec 7 17:26:35 2023 +0100

    busy loop seen on ods export attempt
    
    ScXMLExport::ExportFormatRanges cannot advance because nMaxCols is 0
    so busy loop and no progression
    
    In ScRowFormatRanges::GetMaxRows, aRowFormatRanges is empty which is why
    nMaxCols is 0
    
    In ScFormatRangeStyles::GetFormatRanges aTables appears to be 30 empty
    items.
    
    But why it is empty can't be seen from the bt.
    
    Force this to be an assert to ensure crashtesting can flush out this
    case, rather than letting it get killed off as a timeout.
    
    Set this case as an error and break so failure results in an error
    message of failure to save instead of a hang.
    
    Change-Id: I827e1e638cddd976a48340f86741c21075afe856
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160363
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index e1d1b7bc0f79..59274bd45a5b 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1566,7 +1566,13 @@ void ScXMLExport::ExportFormatRanges(const sal_Int32 
nStartCol, const sal_Int32
                 pRowFormatRanges->Clear();
                 pCellStyles->GetFormatRanges(0, 
pSharedData->GetLastColumn(nSheet), nStartRow + nRows, nSheet, 
pRowFormatRanges.get());
                 sal_Int32 nMaxRows = pRowFormatRanges->GetMaxRows();
-                OSL_ENSURE(nMaxRows, "something went wrong");
+                assert(nMaxRows && "ScXMLExport::ExportFormatRanges cannot 
make progress with zero rows, something went wrong");
+                if (!nMaxRows)
+                {
+                    uno::Sequence<OUString> aEmptySeq;
+                    SetError(XMLERROR_CANCEL|XMLERROR_FLAG_SEVERE, aEmptySeq);
+                    break;
+                }
                 if (nMaxRows >= nTotalRows - nRows)
                 {
                     OpenRow(nSheet, nStartRow + nRows, nTotalRows - nRows, 
aRowAttr);

Reply via email to