Skip to content

Commit 90f2ec5

Browse files
committed
bugfix: incorrect cast causing random memory write
options->app_type was set to mysql_sysvar_t* pointer, later changed to sys_var* pointer, and even later dereferenced as sys_var*. But for PLUGIN_VAR_NOSYSVAR variables the pointer wasn't changed to sys_var*, so mysql_sysvar_t* pointer was dereferenced (and updated!) as if it was sys_var*. This caused maria.maria-gis-recovery test failure on x86 (fulltest2).
1 parent b4daf8e commit 90f2ec5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sql/sql_plugin.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3757,7 +3757,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
37573757

37583758
options->name= optname;
37593759
options->comment= opt->comment;
3760-
options->app_type= opt;
3760+
options->app_type= (opt->flags & PLUGIN_VAR_NOSYSVAR) ? NULL : opt;
37613761
options->id= 0;
37623762

37633763
plugin_opt_set_limits(options, opt);
@@ -3913,6 +3913,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
39133913
v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o);
39143914
if (!(o->flags & PLUGIN_VAR_NOCMDOPT))
39153915
{
3916+
// update app_type, used for I_S.SYSTEM_VARIABLES
39163917
for (my_option *mo=opts; mo->name; mo++)
39173918
if (mo->app_type == o)
39183919
mo->app_type= v;

0 commit comments

Comments
 (0)