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.
This commit is contained in:
Marko Mäkelä 2020-09-04 12:07:46 +03:00
parent 8c2909a2a4
commit c029d45623

View file

@ -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;