Browse Source

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.
bb-10.6-serg
Alexey Botchkov 1 month ago
committed by Sergei Golubchik
parent
commit
32c1725b1b
  1. 5
      sql/handler.h
  2. 6
      sql/sql_show.cc

5
sql/handler.h

@ -1141,7 +1141,10 @@ enum enum_schema_tables
SCH_TABLE_PRIVILEGES,
SCH_TRIGGERS,
SCH_USER_PRIVILEGES,
SCH_VIEWS
SCH_VIEWS,
SCH_N_SERVER_TABLES, /* How many SCHEMA tables in the server. */
SCH_PLUGIN_TABLE /* Schema table defined in plugin. */
};
struct TABLE_SHARE;

6
sql/sql_show.cc

@ -4292,6 +4292,12 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
{
if (schema_table < schema_tables ||
schema_table > &schema_tables[SCH_N_SERVER_TABLES])
{
return SCH_PLUGIN_TABLE;
}
return (enum enum_schema_tables) (schema_table - &schema_tables[0]);
}

Loading…
Cancel
Save