1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Fixed bug#17530: Incorrect key truncation on table creation caused server crash.

When a too long field is used for a key, only a prefix part of the field is 
used. Length is reduced to the max key length allowed for storage. But if the
field have a multibyte charset it is possible to break multibyte char
sequence. This leads to the failed assertion in the innodb code and 
server crash when a record is inserted.

The make_prepare_table() now aligns truncated key length to the boundary of
multibyte char.
This commit is contained in:
evgen@moonbone.local
2006-02-21 18:09:32 +03:00
parent ce4fd24da2
commit e6924206cd
3 changed files with 17 additions and 1 deletions

View File

@@ -1299,7 +1299,9 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
if (length > file->max_key_part_length() && key->type != Key::FULLTEXT)
{
length=file->max_key_part_length();
length= file->max_key_part_length();
/* Align key length to multibyte char boundary */
length-= length % sql_field->charset->mbmaxlen;
if (key->type == Key::MULTIPLE)
{
/* not a critical problem */