summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/unireg.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index d77a6b06275..788046cfae4 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -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