diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-10-27 06:16:02 -0700 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-10-27 06:16:02 -0700 |
commit | 0ba101d4ea8cc081142288a47bdd4e10d83219e9 (patch) | |
tree | 090cd6c0c8479ef071f1edabbf4b79c396257a4a /mysys | |
parent | 6ceaf234bb9fa2e521c67568e1bd6f76ac890ee2 (diff) | |
download | mariadb-git-0ba101d4ea8cc081142288a47bdd4e10d83219e9.tar.gz |
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!
mysys/my_getopt.c:
SETs set-up should set up a default value, but no min/max bounding.
mysys/typelib.c:
fail-safe requested by serg: don't try to skip separator when we're
already at end of string.
sql/sql_plugin.cc:
check_func_set:
Initialize error_len as find_set() will only update it on error,
and we're using the value to see whether an error has occurred (!= 0),
so we'd better not have a random val in there.
value_ptr:
There's no guarantee we're handed string lengths, so play it safe!
Use prepared string lengths where possible for minimum speed gain,
otherwise determine on the fly!
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_getopt.c | 4 | ||||
-rw-r--r-- | mysys/typelib.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index b6eb6dac54f..5e81dbf2ee2 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -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); break; case GET_ULL: - case GET_SET: *((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL); break; + case GET_SET: + *((ulonglong*) variable)= (ulonglong) value; + break; case GET_DOUBLE: *((double*) variable)= (double) value; break; diff --git a/mysys/typelib.c b/mysys/typelib.c index 92ffe9316ff..a0fe8a96a89 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -182,7 +182,10 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err) { (*err)++; 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) DBUG_RETURN(0); result|= (ULL(1) << find); |