Commit a542209b authored by Karthik Kamath's avatar Karthik Kamath

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).
parent 84c32cdb
/* /*
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 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 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, ...@@ -283,6 +283,25 @@ bool mysql_create_frm(THD *thd, const char *file_name,
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0)); keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
key_info_length= pack_keys(keybuff, keys, key_info, data_offset); 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. Ensure that there are no forms in this newly created form file.
Even if the form file exists, create_frm must truncate it to Even if the form file exists, create_frm must truncate it to
......
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