[Commits] Rev 3817: MDEV-4801 - Server crashes in my_strdup on setting in lp:~maria-captains/maria/10.0-serg

Sergey Vojtovich svoj at mariadb.org
Tue Aug 6 13:02:02 EEST 2013


At lp:~maria-captains/maria/10.0-serg

------------------------------------------------------------
revno: 3817
revision-id: svoj at mariadb.org-20130806100207-8zkrkp2ygdazry5p
parent: igor at askmonty.org-20130805205253-v50qbd4bavwmb2z5
committer: Sergey Vojtovich <svoj at mariadb.org>
branch nick: 10.0-serg
timestamp: Tue 2013-08-06 14:02:07 +0400
message:
  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).
=== modified file 'mysql-test/suite/sys_vars/r/innodb_ft_user_stopword_table_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_ft_user_stopword_table_basic.result	2012-09-27 18:09:46 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_ft_user_stopword_table_basic.result	2013-08-06 10:02:07 +0000
@@ -27,3 +27,4 @@ set global innodb_ft_user_stopword_table
 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;

=== modified file 'mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test	2012-09-27 18:09:46 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test	2013-08-06 10:02:07 +0000
@@ -35,3 +35,4 @@ set global innodb_ft_user_stopword_table
 --error ER_WRONG_VALUE_FOR_VAR
 set global innodb_ft_user_stopword_table='Salmon';
 
+SET @@session.innodb_ft_user_stopword_table=@start_global_value;

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2013-07-21 14:39:19 +0000
+++ b/sql/sql_plugin.cc	2013-08-06 10:02:07 +0000
@@ -2700,13 +2700,16 @@ static void update_func_longlong(THD *th
 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;
 }
 
 



More information about the commits mailing list