Skip to content

Commit c029d45

Browse files
committed
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.
1 parent 8c2909a commit c029d45

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7455,6 +7455,8 @@ build_template_field(
74557455
#ifdef HAVE_valgrind_or_MSAN
74567456
MEM_UNDEFINED(templ, sizeof *templ);
74577457
#endif /* HAVE_valgrind_or_MSAN */
7458+
templ->rec_field_is_prefix = FALSE;
7459+
templ->rec_prefix_field_no = ULINT_UNDEFINED;
74587460
templ->is_virtual = !field->stored_in_db();
74597461

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

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

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

0 commit comments

Comments
 (0)