mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
bug#6958
Fixed that negative arguments to certain integer options wrap around. mysql-test/r/variables.result: Added a test case for bug#6958. mysql-test/t/variables.test: Added a test case for bug#6958. sql/set_var.cc: sys_var_long_ptr::check function was added. sql/set_var.h: Use sys_var_long_ptr::check function for sys_var_long_ptr class.
This commit is contained in:
parent
a20f238287
commit
23f786b0ad
4 changed files with 20 additions and 0 deletions
|
@ -482,3 +482,8 @@ SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
|
||||||
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
|
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
myisam_data_pointer_size 8
|
myisam_data_pointer_size 8
|
||||||
|
SET GLOBAL table_cache=-1;
|
||||||
|
SHOW VARIABLES LIKE 'table_cache';
|
||||||
|
Variable_name Value
|
||||||
|
table_cache 1
|
||||||
|
SET GLOBAL table_cache=DEFAULT;
|
||||||
|
|
|
@ -362,3 +362,11 @@ drop table t1;
|
||||||
|
|
||||||
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
|
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
|
||||||
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
|
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #6958: negative arguments to integer options wrap around
|
||||||
|
#
|
||||||
|
|
||||||
|
SET GLOBAL table_cache=-1;
|
||||||
|
SHOW VARIABLES LIKE 'table_cache';
|
||||||
|
SET GLOBAL table_cache=DEFAULT;
|
||||||
|
|
|
@ -1223,6 +1223,12 @@ static void fix_server_id(THD *thd, enum_var_type type)
|
||||||
server_id_supplied = 1;
|
server_id_supplied = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool sys_var_long_ptr::check(THD *thd, set_var *var)
|
||||||
|
{
|
||||||
|
longlong v= var->value->val_int();
|
||||||
|
var->save_result.ulonglong_value= v < 0 ? 0 : v;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool sys_var_long_ptr::update(THD *thd, set_var *var)
|
bool sys_var_long_ptr::update(THD *thd, set_var *var)
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
|
sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
|
||||||
sys_after_update_func func)
|
sys_after_update_func func)
|
||||||
:sys_var(name_arg,func), value(value_ptr) {}
|
:sys_var(name_arg,func), value(value_ptr) {}
|
||||||
|
bool check(THD *thd, set_var *var);
|
||||||
bool update(THD *thd, set_var *var);
|
bool update(THD *thd, set_var *var);
|
||||||
void set_default(THD *thd, enum_var_type type);
|
void set_default(THD *thd, enum_var_type type);
|
||||||
SHOW_TYPE type() { return SHOW_LONG; }
|
SHOW_TYPE type() { return SHOW_LONG; }
|
||||||
|
|
Loading…
Add table
Reference in a new issue