1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Minor correction to the early corruption detection added by

[a6fda39e81d0da98|check-in a6fda39e81d0da98] so that it works even if
the page being cleared in page 1 of the database.

FossilOrigin-Name: a5ec16907ef6ab50e041101d87c5756c71469923872a86c3ab383f188673d7a5
This commit is contained in:
drh
2022-02-14 18:18:56 +00:00
parent 0aa0945111
commit 9a4e88604c
3 changed files with 9 additions and 9 deletions

View File

@@ -6411,7 +6411,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){
assert( CORRUPT_DB || iPage>1 );
assert( !pMemPage || pMemPage->pgno==iPage );
if( NEVER(iPage<2) || iPage>pBt->nPage ){
if( iPage<2 || iPage>pBt->nPage ){
return SQLITE_CORRUPT_BKPT;
}
if( pMemPage ){
@@ -9622,7 +9622,7 @@ static int clearDatabasePage(
rc = getAndInitPage(pBt, pgno, &pPage, 0, 0);
if( rc ) return rc;
if( (pBt->openFlags & BTREE_SINGLE)==0
&& sqlite3PagerPageRefcount(pPage->pDbPage)!=1
&& sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1))
){
rc = SQLITE_CORRUPT_BKPT;
goto cleardatabasepage_out;