1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug#29363867: LOST CONNECTION TO MYSQL SERVER DURING QUERY

plugin variables in SET  only locked the plugin till the end of the
statement. If SET with a plugin variable was prepared, it was possible
to uninstall the plugin before EXECUTE. Then EXECUTE would crash,
trying to resolve a now-invalid pointer to a disappeared variable.

Fix: keep plugins locked until the prepared statement is closed.
This commit is contained in:
Sergei Golubchik
2021-04-26 22:32:58 +02:00
parent 4f63b6cf53
commit 91599701d0
5 changed files with 89 additions and 27 deletions

View File

@ -4307,8 +4307,10 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
thd->release_transactional_locks();
}
/* Preserve CHANGE MASTER attributes */
lex_end_stage1(lex);
/* Preserve locked plugins for SET */
if (lex->sql_command != SQLCOM_SET_OPTION)
lex_unlock_plugins(lex);
cleanup_stmt();
thd->restore_backup_statement(this, &stmt_backup);
thd->stmt_arena= old_stmt_arena;
@ -5189,7 +5191,7 @@ void Prepared_statement::deallocate_immediate()
status_var_increment(thd->status_var.com_stmt_close);
/* It should now be safe to reset CHANGE MASTER parameters */
lex_end_stage2(lex);
lex_end(lex);
}