mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Never allow the b-tree layers view of the number of pages in the database
file exceed the actual number of pages in the database file, even when PRAGMA writeable_schema=ON. This helps with earlier detection of corruption, and prevents excess memory usage and CPU cycles in some integrity_check ops. FossilOrigin-Name: 0407c8793700491b8519a649b9624f569b0e7e9b94d0db79d4a08139e0ecdb69
This commit is contained in:
10
src/btree.c
10
src/btree.c
@@ -3235,9 +3235,13 @@ static int lockBtree(BtShared *pBt){
|
||||
pageSize-usableSize);
|
||||
return rc;
|
||||
}
|
||||
if( sqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto page1_init_failed;
|
||||
if( nPage>nPageFile ){
|
||||
if( sqlite3WritableSchema(pBt->db)==0 ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto page1_init_failed;
|
||||
}else{
|
||||
nPage = nPageFile;
|
||||
}
|
||||
}
|
||||
/* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to
|
||||
** be less than 480. In other words, if the page size is 512, then the
|
||||
|
Reference in New Issue
Block a user