connectivity/source/commontools/dbconversion.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit f96e68ea8d86c78ca94196727e24ba34e38b182e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Oct 1 21:07:52 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Oct 2 14:12:18 2021 +0200

    ofz#39515 avoid Integer-overflow
    
    Change-Id: I8bef8e19f066883d5fc731a1c7b7cd85948ae5c5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122968
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

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;

Reply via email to