From eace834d0830bbf4c89f7f5ea8666fb91527e466 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 2 May 2017 22:32:39 +0200 Subject: Assert that nMonth and nDay <100 to be representable Change-Id: Ie52269478ecac75519d04310a17873904c8167e6 --- tools/source/datetime/tdate.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/source/datetime') diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 3dd8f68b3ced..06c1d0e24454 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -104,6 +104,8 @@ inline sal_uInt16 ImplDaysInMonth( sal_uInt16 nMonth, sal_Int16 nYear ) void Date::setDateFromDMY( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear ) { SAL_WARN_IF( nYear == 0, "tools.datetime", "Date::setDateFromDMY - sure about 0 year? It's not in the calendar."); + assert( nMonth < 100 && "nMonth % 100 not representable" ); + assert( nDay < 100 && "nDay % 100 not representable" ); if (nYear < 0) mnDate = (static_cast( nYear ) * 10000) - -- cgit