diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-14 12:30:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-14 15:36:37 +0200 |
commit | a6ca38e610df2536c07d92a0fa87340886bbdf7d (patch) | |
tree | 401a7b413e2e23e75d42538d2af89ddd8f63f159 | |
parent | 87b26787804cf1839d1eefd54854e647f716d934 (diff) |
tdf#117127 crash on inspecting value describing a table
since...
commit f86d0413f7cedf096b285c2eb6698653dd99c21e
Date: Mon Mar 30 01:26:21 2015 +0200
SwXCellRange:: and SwXTextTable::getDataArray() do the same
which used to have more checks than its replacement
Change-Id: Id931882ef7c749ffa18ef3474e3e661ba8614ab0
Reviewed-on: https://gerrit.libreoffice.org/58976
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index b2e720e9df42..7f832ac8e0d4 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2345,7 +2345,7 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray() std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<sheet::XCellRangeData> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); return xAllRange->getDataArray(); } @@ -2355,7 +2355,7 @@ void SAL_CALL SwXTextTable::setDataArray(const uno::Sequence< uno::Sequence< uno std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<sheet::XCellRangeData> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); return xAllRange->setDataArray(rArray); } @@ -2365,7 +2365,7 @@ uno::Sequence< uno::Sequence< double > > SwXTextTable::getData() std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<chart::XChartDataArray> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); static_cast<SwXCellRange*>(xAllRange.get())->SetLabels( m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel); return xAllRange->getData(); @@ -2377,7 +2377,7 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<chart::XChartDataArray> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); static_cast<SwXCellRange*>(xAllRange.get())->SetLabels( m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel); xAllRange->setData(rData); @@ -2391,7 +2391,7 @@ uno::Sequence<OUString> SwXTextTable::getRowDescriptions() std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<chart::XChartDataArray> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); static_cast<SwXCellRange*>(xAllRange.get())->SetLabels( m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel); return xAllRange->getRowDescriptions(); @@ -2403,7 +2403,7 @@ void SwXTextTable::setRowDescriptions(const uno::Sequence<OUString>& rRowDesc) std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<chart::XChartDataArray> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); static_cast<SwXCellRange*>(xAllRange.get())->SetLabels( m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel); xAllRange->setRowDescriptions(rRowDesc); @@ -2415,7 +2415,7 @@ uno::Sequence<OUString> SwXTextTable::getColumnDescriptions() std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<chart::XChartDataArray> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); static_cast<SwXCellRange*>(xAllRange.get())->SetLabels( m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel); return xAllRange->getColumnDescriptions(); @@ -2427,7 +2427,7 @@ void SwXTextTable::setColumnDescriptions(const uno::Sequence<OUString>& rColumnD std::pair<sal_uInt16, sal_uInt16> const RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this)); uno::Reference<chart::XChartDataArray> const xAllRange( getCellRangeByPosition(0, 0, RowsAndColumns.second-1, RowsAndColumns.first-1), - uno::UNO_QUERY); + uno::UNO_QUERY_THROW); static_cast<SwXCellRange*>(xAllRange.get())->SetLabels( m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel); return xAllRange->setColumnDescriptions(rColumnDesc); @@ -3689,7 +3689,7 @@ SwXCellRange::getData() uno::Reference<chart::XChartDataArray> const xDataRange( getCellRangeByPosition((m_pImpl->m_bFirstColumnAsLabel) ? 1 : 0, (m_pImpl->m_bFirstRowAsLabel) ? 1 : 0, - nColCount-1, nRowCount-1), uno::UNO_QUERY); + nColCount-1, nRowCount-1), uno::UNO_QUERY_THROW); return xDataRange->getData(); } uno::Sequence< uno::Sequence< double > > vRows(nRowCount); @@ -3722,7 +3722,7 @@ SwXCellRange::setData(const uno::Sequence< uno::Sequence<double> >& rData) uno::Reference<chart::XChartDataArray> const xDataRange( getCellRangeByPosition((m_pImpl->m_bFirstColumnAsLabel) ? 1 : 0, (m_pImpl->m_bFirstRowAsLabel) ? 1 : 0, - nColCount-1, nRowCount-1), uno::UNO_QUERY); + nColCount-1, nRowCount-1), uno::UNO_QUERY_THROW); return xDataRange->setData(rData); } lcl_EnsureCoreConnected(m_pImpl->GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)); @@ -3801,6 +3801,8 @@ void SwXCellRange::Impl::SetLabelDescriptions(SwXCellRange & rThis, if(!nRight && !nBottom) throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(&rThis)); auto xLabelRange(rThis.getCellRangeByPosition(nLeft, nTop, nRight, nBottom)); + if (!xLabelRange.is()) + throw uno::RuntimeException("Missing Cell Range", static_cast<cppu::OWeakObject*>(&rThis)); auto vCells(static_cast<SwXCellRange*>(xLabelRange.get())->GetCells()); if (sal::static_int_cast<sal_uInt32>(rDesc.getLength()) != vCells.size()) throw uno::RuntimeException("Too few or too many descriptions", static_cast<cppu::OWeakObject*>(&rThis)); |