diff options
author | unknown <gshchepa/uchum@host.loc> | 2008-02-08 16:04:01 +0400 |
---|---|---|
committer | unknown <gshchepa/uchum@host.loc> | 2008-02-08 16:04:01 +0400 |
commit | 213b4dcd9ede1b1de850d526d6600c5fe4aa5497 (patch) | |
tree | 9f53683c8c9d7140f5bae8faf57146f42f4520d5 /sql/field.cc | |
parent | 1027a2a630e68b3b95f177d4a1bd6df4e500fd4d (diff) | |
download | mariadb-git-213b4dcd9ede1b1de850d526d6600c5fe4aa5497.tar.gz |
Fixed bug#15409: Columns with 64-element SET may not be updated with integers.
SET column storing procedure has been modified to be 64bit-clean.
mysql-test/r/type_set.result:
Added test case for bug#15409.
mysql-test/t/type_set.test:
Added test case for bug#15409.
sql/field.cc:
Fixed bug#15409.
The Field_set::store(longlong nr,...) method incompletely
calculates a bit mask for the comparison with a given number:
if that number is greater than 0x7F00 0000 0000 0000 (LONGLONG_MAX),
it uses zero bit mask instead of 0xFFFF FFFF FFFF FFFF (ULONGLONG_MAX).
Incomplete expression has been replaced with a set_bits macro call.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc index 3753318b8fa..53eafcaf2cc 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7871,10 +7871,10 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs) int Field_set::store(longlong nr, bool unsigned_val) { int error= 0; - if ((ulonglong) nr > (ulonglong) (((longlong) 1 << typelib->count) - - (longlong) 1)) + ulonglong max_nr= set_bits(ulonglong, typelib->count); + if ((ulonglong) nr > max_nr) { - nr&= (longlong) (((longlong) 1 << typelib->count) - (longlong) 1); + nr&= max_nr; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); error=1; } |