|
1 | 1 | /*
|
2 |
| - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
| 2 | + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. |
3 | 3 |
|
4 | 4 | This program is free software; you can redistribute it and/or modify
|
5 | 5 | 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 | 283 | keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
|
284 | 284 | key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
|
285 | 285 |
|
| 286 | + /* key_info_length is currently stored in 2 bytes */ |
| 287 | + if (key_info_length > 65535U) |
| 288 | + { |
| 289 | + char *real_table_name= (char*) table; |
| 290 | + List_iterator<Create_field> it(create_fields); |
| 291 | + Create_field *field; |
| 292 | + while ((field=it++)) |
| 293 | + { |
| 294 | + if (field->field && field->field->table && |
| 295 | + (real_table_name= field->field->table->s->table_name.str)) |
| 296 | + break; |
| 297 | + } |
| 298 | + my_printf_error(ER_UNKNOWN_ERROR, |
| 299 | + "Index information size for the table %s.%s exceeds the " |
| 300 | + "maximum limit (Max: 2 bytes). Please recreate indexes " |
| 301 | + "accordingly.", MYF(0), db, real_table_name); |
| 302 | + goto err; |
| 303 | + } |
| 304 | + |
286 | 305 | /*
|
287 | 306 | Ensure that there are no forms in this newly created form file.
|
288 | 307 | Even if the form file exists, create_frm must truncate it to
|
|
0 commit comments