summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeMoyne Castle <lemoyne.castle@gmail.com>2017-04-25 22:44:16 -0600
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2017-04-29 01:11:22 +0200
commiteea79562f1a5785a8a22cde732a091725e46bbad (patch)
tree055000a17a1e39a0db1ed487ea1906d248fbecc2
parent44555103217df34b218787f3dc6a2634b41fe52e (diff)
tdf#107350 - prevent crash in unotbl.cxx
check pointer and throw exception instead of SIGABRT when reading data from text tables that have varying row &/or col lengths from - merged cells after first row, - split cells in first row, etc. add backstop safety check -> exception because - complexity check fails (wrong/not called) - OOo uno api doc calls for exception when text table is 'too complex' v2: better error message for crash point and its parallel (getData[Array]) Change-Id: Ifb844c3e29042dab6b6cdb2448f7728e6ccb631d Reviewed-on: https://gerrit.libreoffice.org/37002 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
-rw-r--r--sw/source/core/unocore/unotbl.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 4125bc11026b..37d5c1e6da2b 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3621,7 +3621,7 @@ uno::Sequence<uno::Sequence<uno::Any>> SAL_CALL SwXCellRange::getDataArray()
{
auto pCell(static_cast<SwXCell*>(pCurrentCell->get()));
if(!pCell)
- throw uno::RuntimeException();
+ throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
rCellAny = pCell->GetAny();
++pCurrentCell;
}
@@ -3688,6 +3688,8 @@ SwXCellRange::getData()
rRow = uno::Sequence<double>(nColCount);
for(auto& rValue : rRow)
{
+ if(!(*pCurrentCell))
+ throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
rValue = (*pCurrentCell)->getValue();
++pCurrentCell;
}