From 5f2e5ce8606d49355926a391b82fbbebea7a0a7e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 26 Sep 2021 14:05:37 +0100 Subject: ofz#39304 short timestamp record MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8f783473dd5d4679846c7c866cd1853ef7d919fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122628 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit bfc70a9f314bbb5b03247be25544e9b4cc467f8d) --- connectivity/source/drivers/dbase/DTable.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'connectivity/source') diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index f0112d35a03e..8d9539996452 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -775,10 +775,8 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool for (std::size_t i = 1; aIter != aEnd && nByteOffset <= m_nBufferSize && i < nCount;++aIter, i++) { // Lengths depending on data type: - sal_Int32 nLen = 0; - sal_Int32 nType = 0; - nLen = m_aPrecisions[i-1]; - nType = m_aTypes[i-1]; + sal_Int32 nLen = m_aPrecisions[i-1]; + sal_Int32 nType = m_aTypes[i-1]; switch(nType) { @@ -837,8 +835,13 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool else if ( DataType::TIMESTAMP == nType ) { sal_Int32 nDate = 0,nTime = 0; + if (nLen < 8) + { + SAL_WARN("connectivity.drivers", "short TIMESTAMP"); + return false; + } memcpy(&nDate, pData, 4); - memcpy(&nTime, pData+ 4, 4); + memcpy(&nTime, pData + 4, 4); if ( !nDate && !nTime ) { (_rRow->get())[i]->setNull(); -- cgit