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

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.
parent 8c2909a2
...@@ -7455,6 +7455,8 @@ build_template_field( ...@@ -7455,6 +7455,8 @@ build_template_field(
#ifdef HAVE_valgrind_or_MSAN #ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(templ, sizeof *templ); MEM_UNDEFINED(templ, sizeof *templ);
#endif /* HAVE_valgrind_or_MSAN */ #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(); templ->is_virtual = !field->stored_in_db();
if (!templ->is_virtual) { if (!templ->is_virtual) {
...@@ -7516,8 +7518,6 @@ build_template_field( ...@@ -7516,8 +7518,6 @@ build_template_field(
<< " query " << " query "
<< innobase_get_stmt_unsafe(current_thd, &size); << 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)) { if (dict_index_is_clust(index)) {
templ->rec_field_no = templ->clust_rec_field_no; templ->rec_field_no = templ->clust_rec_field_no;
...@@ -7535,7 +7535,6 @@ build_template_field( ...@@ -7535,7 +7535,6 @@ build_template_field(
DBUG_ASSERT(!ha_innobase::omits_virtual_cols(*table->s)); DBUG_ASSERT(!ha_innobase::omits_virtual_cols(*table->s));
col = &dict_table_get_nth_v_col(index->table, v_no)->m_col; col = &dict_table_get_nth_v_col(index->table, v_no)->m_col;
templ->clust_rec_field_no = v_no; templ->clust_rec_field_no = v_no;
templ->rec_prefix_field_no = ULINT_UNDEFINED;
if (dict_index_is_clust(index)) { if (dict_index_is_clust(index)) {
templ->rec_field_no = templ->clust_rec_field_no; templ->rec_field_no = templ->clust_rec_field_no;
......
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