Commit b21930fb authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-18749: Uninitialized value upon ADD FULLTEXT INDEX

row_merge_create_fts_sort_index(): Initialize dict_col_t.

This fixes an access to uninitialized dict_col_t::ind when a debug
assertion in MariaDB 10.4 invokes is_dropped() in
rec_get_converted_size_comp_prefix_low(). Older MariaDB versions
seem to be unaffected by the uninitialized values, but it should
not hurt to initialize everything.
parent 91e4f003
......@@ -98,8 +98,8 @@ row_merge_create_fts_sort_index(
field = dict_index_get_nth_field(new_index, 0);
field->name = NULL;
field->prefix_len = 0;
field->col = static_cast<dict_col_t*>(
mem_heap_alloc(new_index->heap, sizeof(dict_col_t)));
field->col = new(mem_heap_zalloc(new_index->heap, sizeof(dict_col_t)))
dict_col_t();
field->col->prtype = idx_field->col->prtype | DATA_NOT_NULL;
field->col->mtype = charset == &my_charset_latin1
? DATA_VARCHAR : DATA_VARMYSQL;
......@@ -113,8 +113,8 @@ row_merge_create_fts_sort_index(
field = dict_index_get_nth_field(new_index, 1);
field->name = NULL;
field->prefix_len = 0;
field->col = static_cast<dict_col_t*>(
mem_heap_alloc(new_index->heap, sizeof(dict_col_t)));
field->col = new(mem_heap_zalloc(new_index->heap, sizeof(dict_col_t)))
dict_col_t();
field->col->mtype = DATA_INT;
*opt_doc_id_size = FALSE;
......@@ -148,21 +148,16 @@ row_merge_create_fts_sort_index(
field->col->prtype = DATA_NOT_NULL | DATA_BINARY_TYPE;
field->col->mbminlen = 0;
field->col->mbmaxlen = 0;
/* The third field is on the word's position in the original doc */
field = dict_index_get_nth_field(new_index, 2);
field->name = NULL;
field->prefix_len = 0;
field->col = static_cast<dict_col_t*>(
mem_heap_alloc(new_index->heap, sizeof(dict_col_t)));
field->col = new(mem_heap_zalloc(new_index->heap, sizeof(dict_col_t)))
dict_col_t();
field->col->mtype = DATA_INT;
field->col->len = 4 ;
field->fixed_len = 4;
field->col->prtype = DATA_NOT_NULL;
field->col->mbminlen = 0;
field->col->mbmaxlen = 0;
return(new_index);
}
......
......@@ -101,8 +101,8 @@ row_merge_create_fts_sort_index(
field = dict_index_get_nth_field(new_index, 0);
field->name = NULL;
field->prefix_len = 0;
field->col = static_cast<dict_col_t*>(
mem_heap_alloc(new_index->heap, sizeof(dict_col_t)));
field->col = new(mem_heap_zalloc(new_index->heap, sizeof(dict_col_t)))
dict_col_t();
field->col->prtype = idx_field->col->prtype | DATA_NOT_NULL;
field->col->mtype = charset == &my_charset_latin1
? DATA_VARCHAR : DATA_VARMYSQL;
......@@ -116,8 +116,8 @@ row_merge_create_fts_sort_index(
field = dict_index_get_nth_field(new_index, 1);
field->name = NULL;
field->prefix_len = 0;
field->col = static_cast<dict_col_t*>(
mem_heap_alloc(new_index->heap, sizeof(dict_col_t)));
field->col = new(mem_heap_zalloc(new_index->heap, sizeof(dict_col_t)))
dict_col_t();
field->col->mtype = DATA_INT;
*opt_doc_id_size = FALSE;
......@@ -151,21 +151,16 @@ row_merge_create_fts_sort_index(
field->col->prtype = DATA_NOT_NULL | DATA_BINARY_TYPE;
field->col->mbminlen = 0;
field->col->mbmaxlen = 0;
/* The third field is on the word's position in the original doc */
field = dict_index_get_nth_field(new_index, 2);
field->name = NULL;
field->prefix_len = 0;
field->col = static_cast<dict_col_t*>(
mem_heap_alloc(new_index->heap, sizeof(dict_col_t)));
field->col = new(mem_heap_zalloc(new_index->heap, sizeof(dict_col_t)))
dict_col_t();
field->col->mtype = DATA_INT;
field->col->len = 4 ;
field->fixed_len = 4;
field->col->prtype = DATA_NOT_NULL;
field->col->mbminlen = 0;
field->col->mbmaxlen = 0;
return(new_index);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment