1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-04 04:42:17 +03:00

Better handle a case of database corruption where a b-tree page is one of its own ancestor pages.

FossilOrigin-Name: a24e46804893a7e6e8f3130abca882f9a3aa3b7b2b82aa39a0a20856172766d5
This commit is contained in:
dan
2022-09-30 20:15:21 +00:00
parent cb57716c65
commit ad658b2d82
3 changed files with 13 additions and 8 deletions

View File

@@ -8774,6 +8774,11 @@ static int balance(BtCursor *pCur){
}else{
break;
}
}else if( sqlite3PagerPageRefcount(pPage->pDbPage)>1 ){
/* The page being written is not a root page, and there is currently
** more than one reference to it. This only happens if the page is one
** of its own ancestor pages. Corruption. */
rc = SQLITE_CORRUPT_BKPT;
}else{
MemPage * const pParent = pCur->apPage[iPage-1];
int const iIdx = pCur->aiIdx[iPage-1];