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

New commits:
commit eec05aa9cf4a283efa3be76ecf18aa77f714d26e
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Dec 7 12:30:37 2023 +0000
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri Dec 8 07:20:38 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/+/160428
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 4a9b9db6662a..6b5a0592a195 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1565,7 +1565,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