summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-10-01 21:07:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-10-02 14:12:18 +0200
commitf96e68ea8d86c78ca94196727e24ba34e38b182e (patch)
treeb1dc86b71e19c7d72e46e6fa49b587369e1de768 /connectivity
parentf451494e385fa63fef3ffbeec0f85cea4f3e7db3 (diff)
ofz#39515 avoid Integer-overflow
Change-Id: I8bef8e19f066883d5fc731a1c7b7cd85948ae5c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122968 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/dbconversion.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 6a2e21191fa4..e7df86d39215 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -377,6 +377,14 @@ namespace dbtools
css::util::DateTime DBTypeConversion::toDateTime(const double dVal, const css::util::Date& _rNullDate)
{
+ css::util::DateTime aRet;
+
+ if (!std::isfinite(dVal))
+ {
+ SAL_WARN("connectivity.commontools", "DateTime has invalid value: " << dVal);
+ return aRet;
+ }
+
css::util::Date aDate = toDate(dVal, _rNullDate);
// there is not enough precision in a double to have both a date
// and a time up to nanoseconds -> limit to microseconds to have
@@ -384,8 +392,6 @@ namespace dbtools
// 12:59:59.999999790
css::util::Time aTime = toTime(dVal, 6);
- css::util::DateTime aRet;
-
aRet.Day = aDate.Day;
aRet.Month = aDate.Month;
aRet.Year = aDate.Year;