1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-7362: ANALYZE TABLES crash with table-independent-statistics gathering

FULLTEXT indexes do not permit index first lookups. By calling:
ha_index_first() with a garbage parameter, random data gets overwritten
that causes the table->field array to be corrupted. Subsequently, when
the field array is accessed, a segfault occurs.

By not allowing index statistics for FULLTEXT indexes, the problem is
resolved.
This commit is contained in:
Vicențiu Ciorbaru
2015-01-17 16:58:10 +00:00
parent 6e6750ad6c
commit 09d54b37f5
3 changed files with 71 additions and 2 deletions

View File

@ -2355,9 +2355,15 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index)
int rc= 0;
KEY *key_info= &table->key_info[index];
ha_rows rows= 0;
Index_prefix_calc index_prefix_calc(table, key_info);
DBUG_ENTER("collect_statistics_for_index");
/* No statistics for FULLTEXT indexes. */
if (key_info->flags & HA_FULLTEXT)
DBUG_RETURN(rc);
Index_prefix_calc index_prefix_calc(table, key_info);
DEBUG_SYNC(table->in_use, "statistics_collection_start1");
DEBUG_SYNC(table->in_use, "statistics_collection_start2");
@ -2391,7 +2397,7 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index)
if (!rc)
index_prefix_calc.get_avg_frequency();
DBUG_RETURN(rc);
DBUG_RETURN(rc);
}