-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-32640 Reset thd->lex->mi.connection_name.str towards the end of …
…mysql_execute_command Reset the connection_name to contain a null string, if the pointer points to the same space as that of the system variable default_master_connection. We do this because the system variable may be updated which could free the pointer and create a new one, causing use-after-free for re-execution of prepared statements and stored procedures where the LEX may be reused. This allows connection_name to be set again be to the system variable pointer in the next call of this function (see earlier in this function), after any possible updates to the system variable.
- Loading branch information
1 parent
0e8e157
commit b86a2f0
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
PREPARE s_1 FROM 'SHOW RELAYLOG EVENTS'; | ||
/* 1 */ SET default_master_connection='MASTER'; | ||
/* 1 */ EXECUTE s_1; | ||
ERROR HY000: There is no master connection 'MASTER' | ||
/* 2 */ SET default_master_connection='MASTER'; | ||
/* 2 */ EXECUTE s_1; | ||
ERROR HY000: There is no master connection 'MASTER' | ||
create procedure p() SHOW RELAYLOG EVENTS; | ||
/* 1 */ SET default_master_connection='MASTER'; | ||
/* 1 */ call p; | ||
ERROR HY000: There is no master connection 'MASTER' | ||
/* 2 */ SET default_master_connection='MASTER'; | ||
/* 2 */ call p; | ||
ERROR HY000: There is no master connection 'MASTER' | ||
drop procedure p; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--source include/not_embedded.inc | ||
|
||
PREPARE s_1 FROM 'SHOW RELAYLOG EVENTS'; | ||
/* 1 */ SET default_master_connection='MASTER'; | ||
--error WARN_NO_MASTER_INFO | ||
/* 1 */ EXECUTE s_1; | ||
/* 2 */ SET default_master_connection='MASTER'; | ||
--error WARN_NO_MASTER_INFO | ||
/* 2 */ EXECUTE s_1; | ||
|
||
create procedure p() SHOW RELAYLOG EVENTS; | ||
/* 1 */ SET default_master_connection='MASTER'; | ||
--error WARN_NO_MASTER_INFO | ||
/* 1 */ call p; | ||
/* 2 */ SET default_master_connection='MASTER'; | ||
--error WARN_NO_MASTER_INFO | ||
/* 2 */ call p; | ||
drop procedure p; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters