mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-31150 Crash on 2nd execution of update using mergeable derived table
This bug caused crashes of the server on the second execution of update statements that used mergeable derived tables. The crashes happened in the function multi_update_check_table_access() when the code tried to dereference the pointer stored in field TABLE_LIST::TABLE for a mergeable derived table. The fact is this field is set to NULL after the first execution of the query. At the same any action performed by the function is actually not needed for derived tables. Approved by Oleksandr Byelkin <sanja@mariadb.com>
This commit is contained in:
@ -1497,6 +1497,14 @@ static bool multi_update_check_table_access(THD *thd, TABLE_LIST *table,
|
||||
else
|
||||
{
|
||||
/* Must be a base or derived table. */
|
||||
/*
|
||||
Derived tables do not need the check below.
|
||||
Besides one have take into account that for mergeable derived tables
|
||||
TABLE_LIST::TABLE is set to NULL after the first execution of the query.
|
||||
*/
|
||||
if (table->is_derived())
|
||||
return false;
|
||||
|
||||
const bool updated= table->table->map & tables_for_update;
|
||||
if (check_table_access(thd, updated ? UPDATE_ACL : SELECT_ACL, table,
|
||||
FALSE, 1, FALSE))
|
||||
|
Reference in New Issue
Block a user