Skip to content

Commit ef12a46

Browse files
committed
Bug #22131713 QUERYING STATUS_BY_USER/HOST/ACCOUNT CAUSES THE MYSQL SERVER TO CRASH
Issue: ------ While aggregating stats for user/host/account a null check was missing to make sure account stats exist. In specific case reported here, stats for account were not supposed to be collected as specified by user therefore absense of this NULL check was causing crash. Fix: ---- Addded a NULL check before dereferencing account stats pointer.
1 parent 62f23fc commit ef12a46

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

storage/perfschema/pfs_visitor.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,12 @@ class All_host_THD_visitor_adapter : public Do_THD_Impl
132132
if (pfs != NULL)
133133
{
134134
PFS_account *account= sanitize_account(pfs->m_account);
135-
if (account->m_host == m_host)
135+
if (account != NULL)
136136
{
137-
m_visitor->visit_THD(thd);
137+
if (account->m_host == m_host)
138+
{
139+
m_visitor->visit_THD(thd);
140+
}
138141
}
139142
else if (pfs->m_host == m_host)
140143
{
@@ -218,9 +221,12 @@ class All_user_THD_visitor_adapter : public Do_THD_Impl
218221
if (pfs != NULL)
219222
{
220223
PFS_account *account= sanitize_account(pfs->m_account);
221-
if (account->m_user == m_user)
224+
if (account != NULL)
222225
{
223-
m_visitor->visit_THD(thd);
226+
if (account->m_user == m_user)
227+
{
228+
m_visitor->visit_THD(thd);
229+
}
224230
}
225231
else if (pfs->m_user == m_user)
226232
{

0 commit comments

Comments
 (0)