[Libreoffice-commits] core.git: Branch 'libreoffice-7-2-2' - connectivity/source
connectivity/source/drivers/dbase/DTable.cxx | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) New commits: commit 4e76220028b5db5018425a08c764ec073020232c Author: Caolán McNamara AuthorDate: Sun Sep 26 14:05:37 2021 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Wed Sep 29 07:37:28 2021 +0200 ofz#39304 short timestamp record Change-Id: I8f783473dd5d4679846c7c866cd1853ef7d919fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122645 Reviewed-by: Michael Stahl Reviewed-by: Xisco Fauli Reviewed-by: Adolfo Jayme Barrientos Tested-by: Adolfo Jayme Barrientos diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 5b1ea452f61a..8b36eb3b3cf4 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -772,10 +772,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) { @@ -834,8 +832,13 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool else if ( DataType::TIMESTAMP == nType ) { sal_Int32 nDate = 0,nTime = 0; +if (o3tl::make_unsigned(nLen) < 8) +{ +SAL_WARN("connectivity.drivers", "short TIMESTAMP"); +return false; +} memcpy(, pData, 4); -memcpy(, pData+ 4, 4); +memcpy(, pData + 4, 4); if ( !nDate && !nTime ) { (*_rRow)[i]->setNull();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2-2' - connectivity/source
connectivity/source/commontools/dbconversion.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit 2736a88f77e02786343c21359adfb6f6bb04beab Author: Caolán McNamara AuthorDate: Sun Sep 26 14:23:54 2021 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Wed Sep 29 07:36:31 2021 +0200 ofz#39301 month has to be in range [1-12] Change-Id: I5a4ca534b24098342d8f465a32bc1887f40f5b63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122646 Reviewed-by: Michael Stahl Reviewed-by: Xisco Fauli Reviewed-by: Adolfo Jayme Barrientos Tested-by: Adolfo Jayme Barrientos diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index 13a799e55a9a..96b1f1dcfd0a 100644 --- a/connectivity/source/commontools/dbconversion.cxx +++ b/connectivity/source/commontools/dbconversion.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -163,10 +164,13 @@ namespace dbtools ; } - static sal_Int32 implDaysInMonth(sal_Int32 _nMonth, sal_Int32 _nYear) { -OSL_ENSURE(_nMonth > 0 && _nMonth < 13,"Month as invalid value!"); +SAL_WARN_IF(_nMonth < 1 || _nMonth > 12, "connectivity.commontools", "Month has invalid value: " << _nMonth); +if (_nMonth < 1) +_nMonth = 1; +else if (_nMonth > 12) +_nMonth = 12; if (_nMonth != 2) return aDaysInMonth[_nMonth-1]; else @@ -178,7 +182,6 @@ namespace dbtools } } - static sal_Int32 implRelativeToAbsoluteNull(const css::util::Date& _rDate) { sal_Int32 nDays = 0;