mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user