summaryrefslogtreecommitdiffstats
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-09-26 14:23:54 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-17 10:30:10 +0100
commitf5e5592410049ad505c123100e0350579246e391 (patch)
tree45931ac05882e5b3ebafcf23201cde8bfd5aaeed /connectivity
parentofz#39252 use safer SwUnoCursor for the pos to move back to (diff)
downloadcore-f5e5592410049ad505c123100e0350579246e391.tar.gz
core-f5e5592410049ad505c123100e0350579246e391.zip
ofz#39301 month has to be in range [1-12]
Change-Id: I5a4ca534b24098342d8f465a32bc1887f40f5b63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122629 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 4a93b7a2f8a3fc13fed800d93e2103b785abeb62) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125330 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/dbconversion.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 77e7c871123c..6cd27e46a5ff 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -27,6 +27,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>
@@ -167,10 +168,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
@@ -182,7 +186,6 @@ namespace dbtools
}
}
-
static sal_Int32 implRelativeToAbsoluteNull(const css::util::Date& _rDate)
{
sal_Int32 nDays = 0;