1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Bug#54783: optimize table crashes with invalid timestamp default

value and NO_ZERO_DATE

The problem was that a older version of the error path for a
failed admin statement relied upon a few error conditions being
met in order to access a table handler, the first one being that
the table object pointer was not NULL. Probably due to chance,
in all cases a table object was closed but the reference wasn't
reset, the other conditions didn't evaluate to true. With the
addition of a new check on the error path, the handler started
being dereferenced whenever it was not reset to NULL, causing
problems for code paths which closed the table but didn't reset
the reference.

The solution is to reset the reference whenever a admin statement
fails and the tables are closed.
This commit is contained in:
Davi Arnaut
2010-07-06 14:38:03 -03:00
parent bf4a5d961d
commit 07a9c082d9
3 changed files with 37 additions and 0 deletions

View File

@@ -4930,6 +4930,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
*/
if (thd->stmt_da->is_ok())
thd->stmt_da->reset_diagnostics_area();
table->table= NULL;
result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
goto send_result;
}
}
@@ -5060,6 +5062,7 @@ send_result_message:
trans_commit_stmt(thd);
trans_commit(thd);
close_thread_tables(thd);
table->table= NULL;
thd->mdl_context.release_transactional_locks();
if (!result_code) // recreation went ok
{