diff options
author | Sergey Glukhov <sergey.glukhov@oracle.com> | 2011-03-28 12:35:50 +0400 |
---|---|---|
committer | Sergey Glukhov <sergey.glukhov@oracle.com> | 2011-03-28 12:35:50 +0400 |
commit | a88faf2a4af5f60722647a8e01de6aac20305bb7 (patch) | |
tree | 08ac663e3fedcc6a9c0624a3090db1138ce8bc2c /sql/item_func.cc | |
parent | ff23f5360ee328bd6adb14436e68e080cfe1d110 (diff) | |
download | mariadb-git-a88faf2a4af5f60722647a8e01de6aac20305bb7.tar.gz |
Bug#11764994 57900: CREATE TABLE .. SELECT ASSERTS SCALE >= 0 && PRECISION > 0 && SCALE <= PR
Assert fails due to overflow which happens in
Item_func_int_val::fix_num_length_and_dec() as
geometry functions have max_length value equal to
max_field_size(4294967295U). The fix is to skip
max_length calculation for some boundary cases.
mysql-test/r/func_math.result:
test case
mysql-test/t/func_math.test:
test case
sql/item_func.cc:
skip max_length calculation
if argument max_length is near max_field_size.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index d4fd2c94e1d..79fa37bd372 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1803,9 +1803,10 @@ void Item_func_integer::fix_length_and_dec() void Item_func_int_val::fix_num_length_and_dec() { - max_length= args[0]->max_length - (args[0]->decimals ? - args[0]->decimals + 1 : - 0) + 2; + ulonglong tmp_max_length= (ulonglong ) args[0]->max_length - + (args[0]->decimals ? args[0]->decimals + 1 : 0) + 2; + max_length= tmp_max_length > (ulonglong) max_field_size ? + max_field_size : (uint32) tmp_max_length; uint tmp= float_length(decimals); set_if_smaller(max_length,tmp); decimals= 0; |