[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - connectivity/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 27 10:16:58 UTC 2021


 connectivity/source/commontools/dbconversion.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit bc5dece13b5a78f3d8f9e699cd9dcf6bc7b2b7f8
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 26 14:23:54 2021 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Sep 27 12:16:21 2021 +0200

    ofz#39301 month has to be in range [1-12]
    
    Change-Id: I5a4ca534b24098342d8f465a32bc1887f40f5b63
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122635
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

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 <rtl/character.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/math.hxx>
+#include <sal/log.hxx>
 #include <unotools/datetime.hxx>
 #include <sstream>
 #include <iomanip>
@@ -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;


More information about the Libreoffice-commits mailing list