1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Fixed crash in connect.misc with embedded server

The problem was that connect tried to recusiverly call
emb_advanced_command(), which was not supported.

Fixed by adding support for recursive calls.
This commit is contained in:
Monty
2024-02-26 14:51:27 +02:00
parent 0c079f4f76
commit 89aae15da2
3 changed files with 26 additions and 4 deletions

View File

@@ -111,7 +111,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
MYSQL_STMT *stmt)
{
my_bool result= 1;
THD *thd=(THD *) mysql->thd;
THD *thd=(THD *) mysql->thd, *old_current_thd= current_thd;
NET *net= &mysql->net;
my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
@@ -122,6 +122,8 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
else
{
free_embedded_thd(mysql);
if (old_current_thd == thd)
old_current_thd= 0;
thd= 0;
}
}
@@ -179,6 +181,8 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
end:
thd->reset_globals();
if (old_current_thd)
old_current_thd->store_globals();
return result;
}
@@ -432,12 +436,15 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row)
static void free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
THD *thd= (THD*)mysql->thd, *org_current_thd= current_thd;
server_threads.erase(thd);
thd->clear_data_list();
thd->store_globals();
delete thd;
set_current_thd(nullptr);
if (thd == org_current_thd)
set_current_thd(nullptr);
else
set_current_thd(org_current_thd);
mysql->thd=0;
}
@@ -727,6 +734,17 @@ void *create_embedded_thd(ulong client_flag)
}
THD *embedded_get_current_thd()
{
return current_thd;
}
void embedded_set_current_thd(THD *thd)
{
set_current_thd(thd);
}
#ifdef NO_EMBEDDED_ACCESS_CHECKS
static void
emb_transfer_connect_attrs(MYSQL *mysql)