summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2021-07-23 17:12:05 +0200
committerAndras Timar <andras.timar@collabora.com>2021-08-16 10:07:50 +0200
commit2c52969d3d2ea8d8dcbbb017497eccda0d459266 (patch)
tree7ff02c8d8d0e22e6d1276e0d8b449e10c3ffbd8b /writerfilter
parentd5e610524ecf0b4b4fba97f0feb14ce4b46a27e2 (diff)
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@sil.org> (cherry picked from commit 82b14219969c4f80d421015c9e89e8d3db4650d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119616 Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit edc53ec766993b0b7910e87b3765d720565191d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119979
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/TableManager.cxx6
1 files changed, 6 insertions, 0 deletions
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;