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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 29 04:22:06 UTC 2021


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

New commits:
commit 82b14219969c4f80d421015c9e89e8d3db4650d8
Author:     Justin Luth <jluth at mail.com>
AuthorDate: Fri Jul 23 17:12:05 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Thu Jul 29 06:21:32 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().
    
    Change-Id: I5a27dc40db18f05ad4656789d3e61ec1ff4de471
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119420
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

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