diff options
author | Gleb Shchepa <gshchepa@mysql.com> | 2009-01-23 22:18:02 +0400 |
---|---|---|
committer | Gleb Shchepa <gshchepa@mysql.com> | 2009-01-23 22:18:02 +0400 |
commit | 93991b6be983c11dfb595e9ee0647384dc37b09c (patch) | |
tree | a1139da70074b055b8328abd316f07ea040e0823 /sql/item_func.cc | |
parent | db337eb8d8c2dc6c343b89ac78be8966d14a85fc (diff) | |
download | mariadb-git-93991b6be983c11dfb595e9ee0647384dc37b09c.tar.gz |
Bug#42188: crash and/or memory corruption with user variables
in trigger
Interchangeable calls to the mysql_change_user client function
and invocations of a trigger changing some user variable caused
a memory corruption and a crash.
The mysql_change_user API call forces TDH::cleanup() on a server
that frees user variable entries.
However it didn't reset Item_func_set_user_var::entry to NULL
because Item_func_set_user_var::cleanup() was not overloaded.
So, Item_func_set_user_var::entry held a pointer to freed memory,
that caused a crash.
The Item_func_set_user_var::cleanup method has been overloaded
to cleanup the Item_func_set_user_var::entry field.
mysql-test/r/user_var.result:
Added test case for bug #42188.
mysql-test/t/user_var.test:
Added test case for bug #42188.
sql/item_func.cc:
Bug#42188: crash and/or memory corruption with user variables
in trigger
The Item_func_set_user_var::cleanup method has been overloaded
to cleanup the Item_func_set_user_var::entry field.
sql/item_func.h:
Bug#42188: crash and/or memory corruption with user variables
in trigger
The Item_func_set_user_var::cleanup method has been overloaded
to cleanup the Item_func_set_user_var::entry field.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index ff0c22ecfa9..34cb50ee7fa 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3808,6 +3808,13 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, } +void Item_func_set_user_var::cleanup() +{ + Item_func::cleanup(); + entry= NULL; +} + + bool Item_func_set_user_var::set_entry(THD *thd, bool create_if_not_exists) { if (entry && thd->thread_id == entry_thread_id) |