1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-27048 UBSAN: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'

32-bit variable must be expanded to 64-bit before shift left.
This commit is contained in:
Aleksey Midenkov
2021-11-19 18:06:48 +03:00
parent d9a5c5db07
commit 32e8e84795
3 changed files with 23 additions and 1 deletions

View File

@ -3422,3 +3422,13 @@ drop table t1;
# #
alter table txxx engine=innodb, rename to tyyy; alter table txxx engine=innodb, rename to tyyy;
ERROR 42S02: Table 'test.txxx' doesn't exist ERROR 42S02: Table 'test.txxx' doesn't exist
#
# MDEV-27048 UBSAN: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
#
CREATE TABLE t (a INT,b INT,c INT,x TEXT,y TEXT,z TEXT,id INT UNSIGNED AUTO_INCREMENT,i INT,KEY(id),UNIQUE KEY a (a,b,c));
ALTER TABLE t ADD CONSTRAINT test UNIQUE (id) USING HASH;
ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `id`
DROP TABLE t;
#
# End of 10.7 tests
#

View File

@ -2670,3 +2670,15 @@ drop table t1;
--echo # --echo #
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
alter table txxx engine=innodb, rename to tyyy; alter table txxx engine=innodb, rename to tyyy;
--echo #
--echo # MDEV-27048 UBSAN: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
--echo #
CREATE TABLE t (a INT,b INT,c INT,x TEXT,y TEXT,z TEXT,id INT UNSIGNED AUTO_INCREMENT,i INT,KEY(id),UNIQUE KEY a (a,b,c));
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t ADD CONSTRAINT test UNIQUE (id) USING HASH;
DROP TABLE t;
--echo #
--echo # End of 10.7 tests
--echo #

View File

@ -2545,7 +2545,7 @@ bool ddl_log_write_execute_entry(uint first_entry,
file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (uchar)DDL_LOG_EXECUTE_CODE; file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (uchar)DDL_LOG_EXECUTE_CODE;
int4store(file_entry_buf + DDL_LOG_NEXT_ENTRY_POS, first_entry); int4store(file_entry_buf + DDL_LOG_NEXT_ENTRY_POS, first_entry);
int8store(file_entry_buf + DDL_LOG_ID_POS, (cond_entry << DDL_LOG_RETRY_BITS)); int8store(file_entry_buf + DDL_LOG_ID_POS, ((ulonglong)cond_entry << DDL_LOG_RETRY_BITS));
if (!(*active_entry)) if (!(*active_entry))
{ {