List:Commits« Previous MessageNext Message »
From:Tatiana A. Nurnberg Date:October 27 2009 2:16pm
Subject:bzr commit into mysql-5.1-bugteam branch (azundris:3158) Bug#46586
View as plain text  
#At file:///Users/tnurnberg/forest/46586/51-46586/ based on
revid:azundris@stripped

 3158 Tatiana A. Nurnberg	2009-10-27
      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!

    modified:
      mysys/my_getopt.c
      mysys/typelib.c
      sql/sql_plugin.cc
=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2009-08-28 16:21:54 +0000
+++ b/mysys/my_getopt.c	2009-10-27 13:16:02 +0000
@@ -1012,9 +1012,11 @@ static void init_one_value(const struct 
     *((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;

=== modified file 'mysys/typelib.c'
--- a/mysys/typelib.c	2009-08-28 16:21:54 +0000
+++ b/mysys/typelib.c	2009-10-27 13:16:02 +0000
@@ -182,7 +182,10 @@ my_ulonglong find_typeset(char *x, TYPEL
   {
     (*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);

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2009-09-23 13:21:29 +0000
+++ b/sql/sql_plugin.cc	2009-10-27 13:16:02 +0000
@@ -2066,7 +2066,7 @@ static int check_func_set(THD *thd, stru
   const char *strvalue= "NULL", *str;
   TYPELIB *typelib;
   ulonglong result;
-  uint error_len;
+  uint error_len= 0;                            // init as only set on error
   bool not_used;
   int length;
 
@@ -2665,7 +2665,9 @@ uchar* sys_var_pluginvar::value_ptr(THD 
     {
       if (!(value & mask))
         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(',');
     }
 


Attachment: [text/bzr-bundle] bzr/azundris@mysql.com-20091027131602-tjkh4mg14nai3g6h.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (azundris:3158) Bug#46586Tatiana A. Nurnberg27 Oct 2009