Skip to content

Commit 1e12635

Browse files
PS-9551 fix: Setting MYSQL_COMMAND_LOCAL_THD_HANDLE may crash the server
https://perconadev.atlassian.net/browse/PS-9551 Fixed problem in 'mysql_command_services_imp::set()'. When user sets the 'MYSQL_COMMAND_LOCAL_THD_HANDLE' option very early after server startup (when 'srv_session_server_is_available()' still returns false), 'service->open(nullptr, nullptr)' may return nullptr and it is unsafe to use it afterwards. Fixed by checking for nullness and returning earlier.
1 parent b7cca05 commit 1e12635

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sql/server_component/mysql_command_services_imp.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,8 @@ DEFINE_BOOL_METHOD(mysql_command_services_imp::set,
660660
mysql_session = service->open(nullptr, nullptr);
661661
else
662662
return true;
663+
if (mysql_session == nullptr)
664+
return true;
663665
thd = mysql_session->get_thd();
664666
mcs_ext->is_thd_associated = false;
665667
Security_context_handle sc;

0 commit comments

Comments
 (0)