Kaydet (Commit) eea79562 authored tarafından LeMoyne Castle's avatar LeMoyne Castle Kaydeden (comit) Björn Michaelsen

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/37002Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>
üst 44555103
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment