diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-06-04 16:21:19 +0300 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-06-04 16:21:19 +0300 |
commit | 121e04732ea3b5edf36335f827cc5bcb08fb7665 (patch) | |
tree | 84dac453baa2a878b6dcb1c5ece486502e0d2180 /sql/sql_parse.cc | |
parent | bd9fa7da26a2d37d8fafd26d453ed62e4d97f85f (diff) | |
download | mariadb-git-121e04732ea3b5edf36335f827cc5bcb08fb7665.tar.gz |
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.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 381aa0cf054..d9e1ea9e4e7 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1771,6 +1771,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->enable_slow_log= TRUE; thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */ thd->set_time(); + if (!thd->is_valid_time()) + { + /* + If the time has got past 2038 we need to shut this server down + We do this by making sure every command is a shutdown and we + have enough privileges to shut the server down + + TODO: remove this when we have full 64 bit my_time_t support + */ + thd->security_ctx->master_access|= SHUTDOWN_ACL; + command= COM_SHUTDOWN; + } + VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_id= global_query_id; |