diff options
author | dan <Dan Kennedy> | 2022-09-30 20:15:21 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2022-09-30 20:15:21 +0000 |
commit | ad658b2d829b64767c8fc776865237af7f6e45d0 (patch) | |
tree | 0e6466632e97a8aa5066ed305830a3a618d75cd1 /src | |
parent | cb57716c6537b65faf302461b2cb06b1c5a07a3a (diff) | |
download | sqlite-ad658b2d829b64767c8fc776865237af7f6e45d0.tar.gz sqlite-ad658b2d829b64767c8fc776865237af7f6e45d0.zip |
Better handle a case of database corruption where a b-tree page is one of its own ancestor pages.
FossilOrigin-Name: a24e46804893a7e6e8f3130abca882f9a3aa3b7b2b82aa39a0a20856172766d5
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/btree.c b/src/btree.c index a08ed95d1..6dc92a950 100644 --- a/src/btree.c +++ b/src/btree.c @@ -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]; |