Commit e4ce61ac authored by Alexander Barkov's avatar Alexander Barkov

MDEV-32226 UBSAN shift exponent X is too large for 64-bit type 'long long int' in sql/field.cc

parent 534a2bf1
......@@ -379,3 +379,67 @@ a FLOOR(a) CEILING(a) TRUNCATE(a,0) ROUND(a)
999999999999999999999999999999999999999999999999999999999999 1 1 1 1
DROP TABLE t2;
DROP TABLE t1;
#
# MDEV-32226 UBSAN shift exponent X is too large for 64-bit type 'long long int' in sql/field.cc
#
SET sql_mode='';
CREATE TABLE t (f SET('1','2','3','4','5','6','7','8','9','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'));
Warnings:
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
Note 1291 Column 'f' has duplicated value '1' in SET
INSERT INTO t VALUES ('0');
DROP TABLE t;
......@@ -261,3 +261,12 @@ SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2;
DROP TABLE t1;
--echo #
--echo # MDEV-32226 UBSAN shift exponent X is too large for 64-bit type 'long long int' in sql/field.cc
--echo #
SET sql_mode='';
CREATE TABLE t (f SET('1','2','3','4','5','6','7','8','9','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'));
INSERT INTO t VALUES ('0');
DROP TABLE t;
......@@ -9568,13 +9568,13 @@ int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
/* This is for reading numbers with LOAD DATA INFILE */
char *end;
tmp=my_strntoull(cs,from,length,10,&end,&err);
if (err || end != from+length ||
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
if (err || end != from + length)
{
tmp=0;
set_warning(WARN_DATA_TRUNCATED, 1);
err= 1;
store_type(0);
return 1;
}
return Field_set::store((longlong) tmp, true/*unsigned*/);
}
else if (got_warning)
set_warning(WARN_DATA_TRUNCATED, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment