diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-08-01 11:25:50 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-08-01 11:25:50 +0300 |
commit | 63478e72de6940abae6bb2d3b35c9b1ffa7180d9 (patch) | |
tree | 7bc8dd9428d34a2c8772ea92f55fdc05698db7a9 /storage/innobase/rem | |
parent | a6f7c8edc9b8c394662e06df7421eb6215ced0d3 (diff) | |
download | mariadb-git-63478e72de6940abae6bb2d3b35c9b1ffa7180d9.tar.gz |
MDEV-21098: Assertion failure in rec_get_offsets_func()
The function rec_get_offsets_func() used to hit ut_error
due to an invalid rec_get_status() value of a
ROW_FORMAT!=REDUNDANT record. This fix is twofold:
We will not only avoid a crash on corruption in this case,
but we will also make more effort to validate each record
every time we are iterating over index page records.
rec_get_offsets_func(): Do not crash on a corrupted record.
page_rec_get_nth(): Return nullptr on error.
page_dir_slot_get_rec_validate(): Like page_dir_slot_get_rec(),
but validate the pointer and return nullptr on error.
page_cur_search_with_match(), page_cur_search_with_match_bytes(),
page_dir_split_slot(), page_cur_move_to_next():
Indicate failure in a return value.
page_cur_search(): Replaced with page_cur_search_with_match().
rec_get_next_ptr_const(), rec_get_next_ptr(): Replaced with
page_rec_get_next_low().
TODO: rtr_page_split_initialize_nodes(), rtr_update_mbr_field(),
and possibly other SPATIAL INDEX functions fail to properly handle
errors.
Reviewed by: Thirunarayanan Balathandayuthapani
Tested by: Matthias Leich
Performance tested by: Axel Schwenke
Diffstat (limited to 'storage/innobase/rem')
-rw-r--r-- | storage/innobase/rem/rem0rec.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index bd572372aca..9948f2e4d68 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -864,19 +864,19 @@ rec_get_offsets_func( ut_ad(!n_core); n = dict_index_get_n_unique_in_tree_nonleaf(index) + 1; break; + default: + ut_ad("corrupted record header" == 0); + /* fall through */ case REC_STATUS_INFIMUM: case REC_STATUS_SUPREMUM: /* infimum or supremum record */ ut_ad(rec_get_heap_no_new(rec) == ulint(rec_get_status(rec) - == REC_STATUS_INFIMUM - ? PAGE_HEAP_NO_INFIMUM - : PAGE_HEAP_NO_SUPREMUM)); + == REC_STATUS_INFIMUM + ? PAGE_HEAP_NO_INFIMUM + : PAGE_HEAP_NO_SUPREMUM)); n = 1; break; - default: - ut_error; - return(NULL); } } else { n = rec_get_n_fields_old(rec); |