diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-09-27 09:11:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-09-27 11:14:31 +0200 |
commit | 5d48602bfc2083294fc7d6a370bae4ce689be59e (patch) | |
tree | 483b123cef263cfa3794b95cbf4eef04f81908bd /sw/source/filter/ww8/docxattributeoutput.cxx | |
parent | 2aa3d771f157c60cee3fba867aa5c2ed40258536 (diff) |
crashtesting: crash in DocxAttributeOutput::TableCellProperties
on converting ooo59560-1.sxw to docx
Change-Id: I616b254c83ae168806f08a80c07b14de696cc87b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140642
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5833dd62dbca..b4b19cff7088 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4199,15 +4199,20 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point // Horizontal spans const SwWriteTableRows& rRows = m_xTableWrt->GetRows( ); - SwWriteTableRow *pRow = rRows[ nRow ].get(); - const SwWriteTableCells& rTableCells = pRow->GetCells(); - if (nCell < rTableCells.size() ) + if (nRow >= rRows.size()) + SAL_WARN("sw.ww8", "DocxAttributeOutput::TableCellProperties: out of range row: " << nRow); + else { - const SwWriteTableCell& rCell = *rTableCells[nCell]; - const sal_uInt16 nColSpan = rCell.GetColSpan(); - if ( nColSpan > 1 ) - m_pSerializer->singleElementNS( XML_w, XML_gridSpan, - FSNS( XML_w, XML_val ), OString::number(nColSpan) ); + SwWriteTableRow *pRow = rRows[ nRow ].get(); + const SwWriteTableCells& rTableCells = pRow->GetCells(); + if (nCell < rTableCells.size() ) + { + const SwWriteTableCell& rCell = *rTableCells[nCell]; + const sal_uInt16 nColSpan = rCell.GetColSpan(); + if ( nColSpan > 1 ) + m_pSerializer->singleElementNS( XML_w, XML_gridSpan, + FSNS( XML_w, XML_val ), OString::number(nColSpan) ); + } } // Vertical merges @@ -5086,7 +5091,13 @@ void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer } const SwWriteTableRows& rRows = m_xTableWrt->GetRows( ); - SwWriteTableRow *pRow = rRows[ pTableTextNodeInfoInner->getRow( ) ].get(); + const auto nRow = pTableTextNodeInfoInner->getRow(); + if (nRow >= rRows.size()) + { + SAL_WARN("sw.ww8", "DocxAttributeOutput::TableCellProperties: out of range row: " << nRow); + return; + } + SwWriteTableRow *pRow = rRows[nRow].get(); sal_uInt32 nCell = pTableTextNodeInfoInner->getCell(); const SwWriteTableCells& rTableCells = pRow->GetCells(); if (nCell >= rTableCells.size() ) |