mariadb/sql-common
Evgeny Potemkin 368ac9f03e Bug#57278: Crash on min/max + with date out of range.
MySQL officially supports DATE values starting from 1000-01-01. This is
enforced for int values, but not for string values, thus one
could easily insert '0001-01-01' value. Int values are checked by
number_to_datetime function and Item_cache_datetime::val_str uses it
to fill MYSQL_TIME struct out of cached int value. This leads to the
scenario where Item_cache_datetime caches a non-null datetime value and when
it tries to convert it from int to string number_to_datetime function
treats the value as out-of-range and returns an error and
Item_cache_datetime::val_str returns NULL for a non-null value. Due to this
inconsistency server crashes.

Now number_to_datetime allows DATE values below 1000-01-01 if the
TIME_FUZZY_DATE flag is set. Better NULL handling for Item_cache_datetime.
Added the Item_cache_datetime::store function to reset str_value_cached flag
when an item is stored.

mysql-test/r/type_date.result:
  Added a test case for the bug#57278.
mysql-test/t/type_date.test:
  Added a test case for the bug#57278.
sql-common/my_time.c:
  Bug#57278: Crash on min/max + with date out of range.
  Now number_to_datetime allows DATE values below 1000-01-01 if the
  TIME_FUZZY_DATE flag is set.
sql/item.cc:
  Bug#57278: Crash on min/max + with date out of range.
  Item_cache_datetime::val_str now better handles
  null_value.
2010-11-04 16:18:27 +03:00
..
client.c Fix compilation warnings. 2010-10-12 14:07:13 +04:00
client_plugin.c Fix compile error on Windows after WL#1054 push. 2010-10-04 21:25:53 +02:00
Makefile.am WL#1054: Pluggable authentication support 2010-08-09 11:32:50 +03:00
my_time.c Bug#57278: Crash on min/max + with date out of range. 2010-11-04 16:18:27 +03:00
my_user.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
pack.c Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris 2007-08-13 16:11:25 +03:00