• Sergey Glukhov's avatar
    Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION · a60c39a2
    Sergey Glukhov authored
    calc_daynr() function returns negative result
    if malformed date with zero year and month is used.
    Attempt to calculate week day on negative value
    leads to crash. The fix is return NULL for
    'W', 'a', 'w' specifiers if zero year and month is used.
    Additional fix for calc_daynr():
    --added assertion that result can not be negative
    --return 0 if zero year and month is used
    
    
    mysql-test/r/func_time.result:
      test case
    mysql-test/t/func_time.test:
      test case
    sql-common/my_time.c:
      --added assertion that result can not be negative
      --return 0 if zero year and month is used
    sql/item_timefunc.cc:
      eturn NULL for 'W', 'a', 'w' specifiers
      if zero year and month is used.
    a60c39a2
func_time.test 37.5 KB