Skip to content
Permalink
Browse files
MDEV-23600 follow-up: uninitialized rec_field_is_prefix
build_template_field(): Initialize templ->rec_field_is_prefix
also for indexes on virtual columns. This was caught on 10.5 by
MemorySanitizer as use-of-uninitialized-value in
row_search_with_covering_prefix() when running the test
main.fast_prefix_index_fetch_innodb.
  • Loading branch information
dr-m committed Sep 4, 2020
1 parent 8c2909a commit c029d45
Showing 1 changed file with 2 additions and 3 deletions.
@@ -7455,6 +7455,8 @@ build_template_field(
#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(templ, sizeof *templ);
#endif /* HAVE_valgrind_or_MSAN */
templ->rec_field_is_prefix = FALSE;
templ->rec_prefix_field_no = ULINT_UNDEFINED;
templ->is_virtual = !field->stored_in_db();

if (!templ->is_virtual) {
@@ -7516,8 +7518,6 @@ build_template_field(
<< " query "
<< innobase_get_stmt_unsafe(current_thd, &size);
}
templ->rec_field_is_prefix = FALSE;
templ->rec_prefix_field_no = ULINT_UNDEFINED;

if (dict_index_is_clust(index)) {
templ->rec_field_no = templ->clust_rec_field_no;
@@ -7535,7 +7535,6 @@ build_template_field(
DBUG_ASSERT(!ha_innobase::omits_virtual_cols(*table->s));
col = &dict_table_get_nth_v_col(index->table, v_no)->m_col;
templ->clust_rec_field_no = v_no;
templ->rec_prefix_field_no = ULINT_UNDEFINED;

if (dict_index_is_clust(index)) {
templ->rec_field_no = templ->clust_rec_field_no;

0 comments on commit c029d45

Please sign in to comment.