[Libreoffice-commits] core.git: sw/source

LeMoyne Castle lemoyne.castle at gmail.com
Fri Apr 28 23:11:53 UTC 2017


 sw/source/core/unocore/unotbl.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit eea79562f1a5785a8a22cde732a091725e46bbad
Author: LeMoyne Castle <lemoyne.castle at gmail.com>
Date:   Tue Apr 25 22:44:16 2017 -0600

    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 at libreoffice.org>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

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;
         }


More information about the Libreoffice-commits mailing list