diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-09-14 11:01:14 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-09-14 11:01:14 +0300 |
commit | 71b14446013e2ff4e7f918c70fca95d0795f80e4 (patch) | |
tree | 23dd3a50626e119e4476641ab8df65946355d1a0 /storage/innobase/btr | |
parent | d581ef5b2c68465815d78548357e3e104e39f5d6 (diff) | |
download | mariadb-git-71b14446013e2ff4e7f918c70fca95d0795f80e4.tar.gz |
MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
Add error handling to btr_validate_index when index root block
can't be read because block decryption fails.
Diffstat (limited to 'storage/innobase/btr')
-rw-r--r-- | storage/innobase/btr/btr0btr.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index b764ca579cd..78d7c937a13 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -5123,18 +5123,20 @@ node_ptr_fails: /**************************************************************//** Checks the consistency of an index tree. -@return TRUE if ok */ +@return DB_SUCCESS if ok, error code if not */ UNIV_INTERN -bool +dberr_t btr_validate_index( /*===============*/ dict_index_t* index, /*!< in: index */ const trx_t* trx) /*!< in: transaction or NULL */ { + dberr_t err = DB_SUCCESS; + /* Full Text index are implemented by auxiliary tables, not the B-tree */ if (dict_index_is_online_ddl(index) || (index->type & DICT_FTS)) { - return(true); + return(err); } mtr_t mtr; @@ -5143,21 +5145,27 @@ btr_validate_index( mtr_x_lock(dict_index_get_lock(index), &mtr); - bool ok = true; page_t* root = btr_root_get(index, &mtr); + + if (root == NULL && index->table->is_encrypted) { + err = DB_DECRYPTION_FAILED; + mtr_commit(&mtr); + return err; + } + ulint n = btr_page_get_level(root, &mtr); for (ulint i = 0; i <= n; ++i) { if (!btr_validate_level(index, trx, n - i)) { - ok = false; + err = DB_CORRUPTION; break; } } mtr_commit(&mtr); - return(ok); + return(err); } /**************************************************************//** |