Skip to content
Permalink
Browse files
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.
  • Loading branch information
dr-m committed Mar 6, 2019
1 parent 91e4f00 commit b21930f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
@@ -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);
}

0 comments on commit b21930f

Please sign in to comment.