summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-23 10:04:38 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2020-11-24 14:58:21 +0100
commit1432b115955cec0af8054ae8863a24ddccdd4882 (patch)
tree0f90e2d55b3d53547b0e60e72ea8710c5b5f3f4c
parentMake python3 build on macOS 11, including for arm64 (diff)
downloadcore-1432b115955cec0af8054ae8863a24ddccdd4882.tar.gz
core-1432b115955cec0af8054ae8863a24ddccdd4882.zip
Resolves: rhbz#1900428 don't crash on invalid index used in StarBasic macro
Change-Id: I05064f7e9216c9c43b49950b309afe72466857a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106242 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 0bbe5e80ae0a..df8c46a72554 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -230,11 +230,16 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
OSL_ENSURE( pTemp != reinterpret_cast<void*>(0xfeeefeee),"HALT!" );
}
OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow < m_pCache->getEnd() && aCacheIter != m_pCache->m_aCacheIterators.end(),"Invalid iterator set for currentrow!");
- ORowSetRow rRow = *m_aCurrentRow;
- OSL_ENSURE(rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size(),"Invalid size of vector!");
#endif
+ ORowSetRow rRow = *m_aCurrentRow;
+ bool bValidPosition = rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size();
+ if (!bValidPosition)
+ {
+ SAL_WARN("dbaccess", "ORowSetBase::getValue: Invalid size of vector!");
+ ::dbtools::throwSQLException( DBA_RES( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
+ }
m_nLastColumnIndex = columnIndex;
- return (**m_aCurrentRow)[m_nLastColumnIndex];
+ return (*rRow)[m_nLastColumnIndex];
}
// we should normally never reach this