summaryrefslogtreecommitdiff
path: root/sql/event_db_repository.cc
diff options
context:
space:
mode:
authorAlexander Nozdrin <alexander.nozdrin@oracle.com>2011-05-04 16:59:24 +0400
committerAlexander Nozdrin <alexander.nozdrin@oracle.com>2011-05-04 16:59:24 +0400
commitca6e7781ef47ace73058fd231fd0057e87e86d76 (patch)
treed2b8fa6e7061d19a7f00c761431d8cec474c792d /sql/event_db_repository.cc
parent4f666e8e8130fe5bac078d4c5715c21fd948aa5f (diff)
downloadmariadb-git-ca6e7781ef47ace73058fd231fd0057e87e86d76.tar.gz
Patch for Bug#12394306: the sever may crash if mysql.event is corrupted.
The problem was that wrong structure of mysql.event was not detected and the server continued to use wrongly-structured data. The fix is to check the structure of mysql.event after opening before any use. That makes operations with events more strict -- some operations that might work before throw errors now. That seems to be Ok. Another side-effect of the patch is that if mysql.event is corrupted, unrelated DROP DATABASE statements issue an SQL warning about inability to open mysql.event table.
Diffstat (limited to 'sql/event_db_repository.cc')
-rw-r--r--sql/event_db_repository.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index 7473cf47188..a0765dc6d15 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -582,6 +582,14 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type,
*table= tables.table;
tables.table->use_all_columns();
+
+ if (table_intact.check(*table, &event_table_def))
+ {
+ close_thread_tables(thd);
+ my_error(ER_EVENT_OPEN_TABLE_FAILED, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+
DBUG_RETURN(FALSE);
}