query, report https://gist.github.com/alesapin/c91d9ffd65471c4d8b595219a26a601a.
Full report
https://clickhouse-test-reports.s3.yandex.net/19412/cc2788af881c96701076b366259bc99525d926b1/fuzzer_asan/report.html#fail1
{
        if (!sunday_first_day_of_week)
            return toDayOfWeek(d) - 1;
        else
            return toDayOfWeek(DayNum(d + 1)) - 1;
    }
    
    inline unsigned calc_days_in_year(UInt16 year) const
    {
        return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)) ? 366 : 365);
    }
    
    inline unsigned toRelativeMonthNum(DayNum d) const
    {
        return lut[d].year * 12 + lut[d].month;
    }
    inline unsigned toRelativeMonthNum(time_t t) const
    {
        return toRelativeMonthNum(toDayNum(t));
    }
    inline unsigned toRelativeQuarterNum(DayNum d) const