mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
Creating an EVENT to be executed at a time close to the end of the allowed range (2038.01.19 03:14:07 UTC) would cause the server to crash. The expected behavior is to accept all calendar times within the interval and reject all other values without crashing. This patch replaces the function 'sec_to_epoch_TIME' with a Time_zone API call. This function was broken because it invoked the internal function 'sec_to_epoch' without respecting the restrictions on the function parameters (and this caused assertion failure). It also was used as a reverse function to Time_zone_utc::gmt_sec_to_TIME which it isn't.
This commit is contained in:
@ -979,17 +979,18 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
starts_null= table->field[ET_FIELD_STARTS]->is_null();
|
||||
my_bool not_used= FALSE;
|
||||
if (!starts_null)
|
||||
{
|
||||
table->field[ET_FIELD_STARTS]->get_date(&time, TIME_NO_ZERO_DATE);
|
||||
starts= sec_since_epoch_TIME(&time);
|
||||
starts= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
||||
}
|
||||
|
||||
ends_null= table->field[ET_FIELD_ENDS]->is_null();
|
||||
if (!ends_null)
|
||||
{
|
||||
table->field[ET_FIELD_ENDS]->get_date(&time, TIME_NO_ZERO_DATE);
|
||||
ends= sec_since_epoch_TIME(&time);
|
||||
ends= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
||||
}
|
||||
|
||||
if (!table->field[ET_FIELD_INTERVAL_EXPR]->is_null())
|
||||
@ -1007,7 +1008,7 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
|
||||
if (table->field[ET_FIELD_EXECUTE_AT]->get_date(&time,
|
||||
TIME_NO_ZERO_DATE))
|
||||
DBUG_RETURN(TRUE);
|
||||
execute_at= sec_since_epoch_TIME(&time);
|
||||
execute_at= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1039,7 +1040,7 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
|
||||
{
|
||||
table->field[ET_FIELD_LAST_EXECUTED]->get_date(&time,
|
||||
TIME_NO_ZERO_DATE);
|
||||
last_executed= sec_since_epoch_TIME(&time);
|
||||
last_executed= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
||||
}
|
||||
last_executed_changed= FALSE;
|
||||
|
||||
|
Reference in New Issue
Block a user