mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fixed bug #32034: On 64bit platforms assigning values of
storage engine system variables was not validated and unexpected value was assigned. The check_func_enum function used subtraction from the uint value with the probably negative result. That result of type uint was compared with 0 after casting to signed long type. On architectures where long type is longer than int type the result of comparison was unexpected. storage/example/ha_example.cc: Fixed bug #32034. Sample system variable example_enum_var has been added to the EXAMPLE storage to test ENUM variables. sql/sql_plugin.cc: Fixed bug #32034. The check_func_enum function used subtraction from the uint value with the probably negative result. That result of type uint was compared with 0 after casting to signed long type. On architectures where long type is longer than int type the result of comparison was unexpected. uint value has been casted to long type before subtraction. mysql-test/t/plugin.test: Added test case for bug #32034. mysql-test/r/plugin.result: Added test case for bug #32034.
This commit is contained in:
@@ -1944,7 +1944,7 @@ static int check_func_enum(THD *thd, struct st_mysql_sys_var *var,
|
||||
length= sizeof(buff);
|
||||
if (!(str= value->val_str(value, buff, &length)))
|
||||
goto err;
|
||||
if ((result= find_type(typelib, str, length, 1)-1) < 0)
|
||||
if ((result= (long)find_type(typelib, str, length, 1)-1) < 0)
|
||||
{
|
||||
strvalue= str;
|
||||
goto err;
|
||||
|
Reference in New Issue
Block a user