[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - writerfilter/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 7 20:41:38 UTC 2021


 writerfilter/source/dmapper/TableManager.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 319dc6a20a9a8c84cffc583eefbc94636bf9fee8
Author:     Justin Luth <jluth at mail.com>
AuthorDate: Fri Jul 23 17:12:05 2021 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Aug 7 22:41:04 2021 +0200

    crashreport writerfilter: findColumn(unsigned long,unsigned long)
    
    Although the crash reports don't show getRow as a separate
    item in the list of functions leading to the crash,
    it just CAN'T be a problem with mTableDataStack.empty()
    or !mTableDataStack.top() because they are unconditionally
    used or popped later on in endLevel().
    
    So I resisted the urge to test everything, and just verified
    that the row (which exists for m_aCellProperties) actually
    exists in the table manager - similar to getGridBefore().
    
    These functions were added via
    tdf#129452 writerfilter: use column, not cell when comparing rows
    7.1 commit 19d7f9624e92422409ed2744091d502fdae8692b
    
    The crash report did not identify any example documents
    or reproducable steps, so no unit test was possible.
    
    Change-Id: I5a27dc40db18f05ad4656789d3e61ec1ff4de471
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119420
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit 82b14219969c4f80d421015c9e89e8d3db4650d8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119616
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit edc53ec766993b0b7910e87b3765d720565191d6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119979

diff --git a/writerfilter/source/dmapper/TableManager.cxx b/writerfilter/source/dmapper/TableManager.cxx
index ea71e887adb3..ce1d550d8e55 100644
--- a/writerfilter/source/dmapper/TableManager.cxx
+++ b/writerfilter/source/dmapper/TableManager.cxx
@@ -93,6 +93,9 @@ void TableManager::setCurrentGridSpan(sal_uInt32 nGridSpan, bool bFirstCell)
 
 sal_uInt32 TableManager::findColumn(const sal_uInt32 nRow, const sal_uInt32 nCell)
 {
+    if (nRow >= mTableDataStack.top()->getRowCount())
+        return SAL_MAX_UINT32;
+
     RowData::Pointer_t pRow = mTableDataStack.top()->getRow(nRow);
     if (!pRow || nCell < pRow->getGridBefore()
         || nCell >= pRow->getCellCount() - pRow->getGridAfter())
@@ -110,6 +113,9 @@ sal_uInt32 TableManager::findColumn(const sal_uInt32 nRow, const sal_uInt32 nCel
 
 sal_uInt32 TableManager::findColumnCell(const sal_uInt32 nRow, const sal_uInt32 nCol)
 {
+    if (nRow >= mTableDataStack.top()->getRowCount())
+        return SAL_MAX_UINT32;
+
     RowData::Pointer_t pRow = mTableDataStack.top()->getRow(nRow);
     if (!pRow || nCol < pRow->getGridBefore())
         return SAL_MAX_UINT32;


More information about the Libreoffice-commits mailing list