diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-04-26 22:32:58 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-04-27 18:21:01 +0200 |
commit | 91599701d07a9efb02a2f27d17a8f95bc2b9accf (patch) | |
tree | 90c462a1f291876b51a1dd3ed0e90905b5b92f75 /sql/sql_prepare.cc | |
parent | 4f63b6cf53ce2d9eaf4a8006587ebf3c4d6ddd3c (diff) | |
download | mariadb-git-91599701d07a9efb02a2f27d17a8f95bc2b9accf.tar.gz |
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.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index fa335465f02..56a38757f28 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -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); } |