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

row_undo_mod_clust(): Fix stack-use-after-scope

This is fixing a regression that was introduced in MDEV-15562
commit 0e5a4ac2.

On rollback of UPDATE or DELETE of a ROW_FORMAT=COMPRESSED table,
page_zip_write_trx_id_and_roll_ptr() was accessing
offsets=offsets_ after offsets_ went out of scope.
parent c1e695c9
...@@ -451,6 +451,9 @@ row_undo_mod_clust( ...@@ -451,6 +451,9 @@ row_undo_mod_clust(
ulint trx_id_offset = index->trx_id_offset; ulint trx_id_offset = index->trx_id_offset;
ulint trx_id_pos = index->n_uniq ? index->n_uniq : 1; ulint trx_id_pos = index->n_uniq ? index->n_uniq : 1;
/* Reserve enough offsets for the PRIMARY KEY and
2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */
ulint offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
if (trx_id_offset) { if (trx_id_offset) {
} else if (rec_is_metadata(rec, *index)) { } else if (rec_is_metadata(rec, *index)) {
ut_ad(!buf_block_get_page_zip(btr_pcur_get_block( ut_ad(!buf_block_get_page_zip(btr_pcur_get_block(
...@@ -460,11 +463,6 @@ row_undo_mod_clust( ...@@ -460,11 +463,6 @@ row_undo_mod_clust(
} }
} else { } else {
ut_ad(index->n_uniq <= MAX_REF_PARTS); ut_ad(index->n_uniq <= MAX_REF_PARTS);
/* Reserve enough offsets for the PRIMARY KEY and
2 columns so that we can access
DB_TRX_ID, DB_ROLL_PTR. */
ulint offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS
+ 2];
rec_offs_init(offsets_); rec_offs_init(offsets_);
offsets = rec_get_offsets( offsets = rec_get_offsets(
rec, index, offsets_, true, trx_id_pos + 2, rec, index, offsets_, true, trx_id_pos + 2,
......
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