From 121e04732ea3b5edf36335f827cc5bcb08fb7665 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 4 Jun 2010 16:21:19 +0300 Subject: Bug #52315: utc_date() crashes when system time > year 2037 Some of the server implementations don't support dates later than 2038 due to the internal time type being 32 bit. Added checks so that the server will refuse dates that cannot be handled by either throwing an error when setting date at runtime or by refusing to start or shutting down the server if the system date cannot be stored in my_time_t. --- sql/mysqld.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sql/mysqld.cc') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4b0739cc2d2..bda4e796ce2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2835,6 +2835,14 @@ static int init_common_variables(const char *conf_file_name, int argc, max_system_variables.pseudo_thread_id= (ulong)~0; server_start_time= flush_status_time= time((time_t*) 0); + + /* TODO: remove this when my_time_t is 64 bit compatible */ + if (server_start_time >= (time_t) MY_TIME_T_MAX) + { + sql_print_error("This MySQL server doesn't support dates later then 2038"); + return 1; + } + if (init_thread_environment()) return 1; mysql_init_variables(); -- cgit v1.2.1