Commit 2f069a2c authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

Bug#46586: When using the plugin interface the type "set" for options caused a crash.

"What do you mean, there's a bug? There isn't even code!"

There was some token code for plug-in variables of the SET type,
but clearly this never worked, or was subject to massive bit rot
since. Bug-fixes ... fail-safes ... tests -- fais au mieux, mon chou!
parent 842039a1
...@@ -1012,9 +1012,11 @@ static void init_one_value(const struct my_option *option, uchar* *variable, ...@@ -1012,9 +1012,11 @@ static void init_one_value(const struct my_option *option, uchar* *variable,
*((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL); *((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL);
break; break;
case GET_ULL: case GET_ULL:
case GET_SET:
*((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL); *((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL);
break; break;
case GET_SET:
*((ulonglong*) variable)= (ulonglong) value;
break;
case GET_DOUBLE: case GET_DOUBLE:
*((double*) variable)= (double) value; *((double*) variable)= (double) value;
break; break;
......
...@@ -182,7 +182,10 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err) ...@@ -182,7 +182,10 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err)
{ {
(*err)++; (*err)++;
i= x; i= x;
while (*x && *x != field_separator) x++; while (*x && *x != field_separator)
x++;
if (x[0] && x[1]) // skip separator if found
x++;
if ((find= find_type(i, lib, 2 | 8) - 1) < 0) if ((find= find_type(i, lib, 2 | 8) - 1) < 0)
DBUG_RETURN(0); DBUG_RETURN(0);
result|= (ULL(1) << find); result|= (ULL(1) << find);
......
...@@ -2066,7 +2066,7 @@ static int check_func_set(THD *thd, struct st_mysql_sys_var *var, ...@@ -2066,7 +2066,7 @@ static int check_func_set(THD *thd, struct st_mysql_sys_var *var,
const char *strvalue= "NULL", *str; const char *strvalue= "NULL", *str;
TYPELIB *typelib; TYPELIB *typelib;
ulonglong result; ulonglong result;
uint error_len; uint error_len= 0; // init as only set on error
bool not_used; bool not_used;
int length; int length;
...@@ -2665,7 +2665,9 @@ uchar* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type, ...@@ -2665,7 +2665,9 @@ uchar* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type,
{ {
if (!(value & mask)) if (!(value & mask))
continue; continue;
str.append(typelib->type_names[i], typelib->type_lengths[i]); str.append(typelib->type_names[i], typelib->type_lengths
? typelib->type_lengths[i]
: strlen(typelib->type_names[i]));
str.append(','); str.append(',');
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment