MDEV-7050: MySQL#74603 - Assertion `comma_length > 0' failed in mysql_prepare_create_table

Incorrect array lenght for comma buffer.
This commit is contained in:
Jan Lindström 2015-12-07 09:34:41 +02:00
parent d85168e40d
commit 0df22a539e
3 changed files with 17 additions and 2 deletions

View File

@ -2477,3 +2477,9 @@ t1 CREATE TABLE `t1` (
`c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @@session.collation_server=filename;
create table t1(a enum('',''));
Warnings:
Note 1291 Column 'a' has duplicated value '' in ENUM
drop table t1;
set @@session.collation_server=default;

View File

@ -2053,3 +2053,11 @@ select * from t1;
show create table t1;
drop table t1;
#
# MDEV-7050: MySQL#74603 - Assertion `comma_length > 0' failed in mysql_prepare_create_table
#
set @@session.collation_server=filename;
create table t1(a enum('',''));
drop table t1;
set @@session.collation_server=default;

View File

@ -2986,9 +2986,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list);
List_iterator<String> int_it(sql_field->interval_list);
String conv, *tmp;
char comma_buf[4]; /* 4 bytes for utf32 */
char comma_buf[5]; /* 5 bytes for 'filename' charset */
DBUG_ASSERT(sizeof(comma_buf) >= cs->mbmaxlen);
int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
(uchar*) comma_buf +
(uchar*) comma_buf +
sizeof(comma_buf));
DBUG_ASSERT(comma_length > 0);
for (uint i= 0; (tmp= int_it++); i++)