error in parsing enum value for plugin variable in mysqld command-line option

Bug #423035 reported by Kristian Nielsen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Undecided
Kristian Nielsen

Bug Description

This should fail:

    mysqld --plugin-load=EXAMPLE=ha_example.so --plugin-example-enum-var=noexist

But it does not in current MariaDB 5.1, due to an incorrect cast/unsigned comparison. Instead it sets the variable to some value (0 I think).

Fix:

=== modified file 'mysys/my_getopt.c'
--- mysys/my_getopt.c 2009-05-20 15:34:34 +0000
+++ mysys/my_getopt.c 2009-09-02 08:13:14 +0000
@@ -603,6 +603,7 @@ static int setval(const struct my_option
     my_bool set_maximum_value)
 {
   int err= 0;
+ int pos;

   if (value && argument)
   {
@@ -647,7 +648,9 @@ static int setval(const struct my_option
  return EXIT_OUT_OF_MEMORY;
       break;
     case GET_ENUM:
- if (((*(ulong *)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
+ pos= find_type(argument, opts->typelib, 2) - 1;
+ (*(ulong *)result_pos)= pos;
+ if (pos < 0)
         return EXIT_ARGUMENT_INVALID;
       break;
     case GET_SET:

Bug was introduced with this patch:

------------------------------------------------------------
revno: 2703
revision-id: <email address hidden>
parent: <email address hidden>
committer: <email address hidden>
branch nick: work-5.1-ourdelta
timestamp: Wed 2009-05-20 17:34:34 +0200
message:
  Fix accessing ulong enum option as uint, failing on 64-bit big-endian.

Changed in maria:
assignee: nobody → Kristian Nielsen (knielsen)
status: New → Confirmed
Changed in maria:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.