Merge pull request #10783 from ClickHouse/date-lut-asserts

Asserts in DateLUTImpl
This commit is contained in:
alexey-milovidov 2020-05-10 08:18:22 +03:00 committed by GitHub
commit 52b2b4c2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,6 +75,11 @@ DateLUTImpl::DateLUTImpl(const std::string & time_zone_)
values.day_of_week = getDayOfWeek(date); values.day_of_week = getDayOfWeek(date);
values.date = start_of_day; values.date = start_of_day;
assert(values.year >= DATE_LUT_MIN_YEAR && values.year <= DATE_LUT_MAX_YEAR);
assert(values.month >= 1 && values.month <= 12);
assert(values.day_of_month >= 1 && values.day_of_month <= 31);
assert(values.day_of_week >= 1 && values.day_of_week <= 7);
if (values.day_of_month == 1) if (values.day_of_month == 1)
{ {
cctz::civil_month month(date); cctz::civil_month month(date);