mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
BUG#26529369: CREATE INDEX WITH LONG COMMENT CAUSE
UNEXPECTED ERROR ANALYSIS: ========= Creating many indexes with large amount of index information causes a server exit. FIX: ==== A appropriate error is reported when the cumulative index information length exceeds the 2 byte range (i.e 65535).
This commit is contained in:
parent
84c32cdbe7
commit
a542209b9e
1 changed files with 20 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -283,6 +283,25 @@ bool mysql_create_frm(THD *thd, const char *file_name,
|
|||
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
|
||||
key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
|
||||
|
||||
/* key_info_length is currently stored in 2 bytes */
|
||||
if (key_info_length > 65535U)
|
||||
{
|
||||
char *real_table_name= (char*) table;
|
||||
List_iterator<Create_field> it(create_fields);
|
||||
Create_field *field;
|
||||
while ((field=it++))
|
||||
{
|
||||
if (field->field && field->field->table &&
|
||||
(real_table_name= field->field->table->s->table_name.str))
|
||||
break;
|
||||
}
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"Index information size for the table %s.%s exceeds the "
|
||||
"maximum limit (Max: 2 bytes). Please recreate indexes "
|
||||
"accordingly.", MYF(0), db, real_table_name);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
Ensure that there are no forms in this newly created form file.
|
||||
Even if the form file exists, create_frm must truncate it to
|
||||
|
|
Loading…
Reference in a new issue