MDEV-13542, many sources of crash on a corrupted page were fixed, but something in the function btr_cur_open_at_index_side() was missed.
This assertion could fail if a nonzero parameter level was supplied to the function. That is only the case when the inline wrapper function btr_pcur_open_at_index_side() is invoked with level>0, which in turn is only possible in the following functions, related to InnoDB persistent statistics:
It would seem to make sense to remove the parameter level from the normal functions, and to write a special function that would be used when computing persistent statistics.
Furthermore, btr_cur_open_at_index_side() currently fails to return DB_CORRUPTION on PAGE_LEVEL mismatch or when from_left ? !page_has_prev(page) : !page_has_next(page) does not hold.