Skip to content

Commit 32c1725

Browse files
Alexey Botchkovvuvova
authored andcommitted
MDEV-35713 UBSAN: runtime error: load of value 1341112147, which is not a valid value for type 'enum enum_schema_tables' in optimize_for_get_all_tables and get_all_tables and on SELECT from I_S geometry_columns.
get_schema_table_idx() returns garbage if the SCHEMA table comes from a plugin. Added specific value to reflect this.
1 parent e238246 commit 32c1725

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sql/handler.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,10 @@ enum enum_schema_tables
11411141
SCH_TABLE_PRIVILEGES,
11421142
SCH_TRIGGERS,
11431143
SCH_USER_PRIVILEGES,
1144-
SCH_VIEWS
1144+
SCH_VIEWS,
1145+
1146+
SCH_N_SERVER_TABLES, /* How many SCHEMA tables in the server. */
1147+
SCH_PLUGIN_TABLE /* Schema table defined in plugin. */
11451148
};
11461149

11471150
struct TABLE_SHARE;

sql/sql_show.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,6 +4292,12 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
42924292

42934293
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
42944294
{
4295+
if (schema_table < schema_tables ||
4296+
schema_table > &schema_tables[SCH_N_SERVER_TABLES])
4297+
{
4298+
return SCH_PLUGIN_TABLE;
4299+
}
4300+
42954301
return (enum enum_schema_tables) (schema_table - &schema_tables[0]);
42964302
}
42974303

0 commit comments

Comments
 (0)