MDEV-4801 - Server crashes in my_strdup on setting
innodb_ft_user_stopword_table to DEFAULT Setting plugin string variable with PLUGIN_VAR_MEMALLOC flag to NULL causes server crash. mysql-test/suite/sys_vars/r/innodb_ft_user_stopword_table_basic.result: Reset innodb_ft_user_stopword_table. Also tests MDEV-4801. mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test: Reset innodb_ft_user_stopword_table. Also tests MDEV-4801. sql/sql_plugin.cc: When we got NULL value, do not strdup(NULL).
This commit is contained in:
parent
9d1f31fb4b
commit
5997156b9b
@ -27,3 +27,4 @@ set global innodb_ft_user_stopword_table=1e1;
|
||||
ERROR 42000: Incorrect argument type to variable 'innodb_ft_user_stopword_table'
|
||||
set global innodb_ft_user_stopword_table='Salmon';
|
||||
ERROR 42000: Variable 'innodb_ft_user_stopword_table' can't be set to the value of 'Salmon'
|
||||
SET @@session.innodb_ft_user_stopword_table=@start_global_value;
|
||||
|
@ -35,3 +35,4 @@ set global innodb_ft_user_stopword_table=1e1;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global innodb_ft_user_stopword_table='Salmon';
|
||||
|
||||
SET @@session.innodb_ft_user_stopword_table=@start_global_value;
|
||||
|
@ -2700,13 +2700,16 @@ static void update_func_longlong(THD *thd, struct st_mysql_sys_var *var,
|
||||
static void update_func_str(THD *thd, struct st_mysql_sys_var *var,
|
||||
void *tgt, const void *save)
|
||||
{
|
||||
char *old= *(char **) tgt;
|
||||
*(char **)tgt= *(char **) save;
|
||||
char *value= *(char**) save;
|
||||
if (var->flags & PLUGIN_VAR_MEMALLOC)
|
||||
{
|
||||
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
|
||||
char *old= *(char**) tgt;
|
||||
if (value)
|
||||
*(char**) tgt= my_strdup(value, MYF(0));
|
||||
my_free(old);
|
||||
}
|
||||
else
|
||||
*(char**) tgt= value;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user