1
0
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:
drh
2022-01-17 14:42:38 +00:00
parent 7d44b22d45
commit 5a6f818d84
4 changed files with 16 additions and 13 deletions

View File

@@ -3945,8 +3945,7 @@ static void assertTruncateConstraint(Pager *pPager){
** then continue writing to the database.
*/
void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
assert( pPager->dbSize>=nPage || CORRUPT_DB );
testcase( pPager->dbSize<nPage );
assert( pPager->dbSize>=nPage );
assert( pPager->eState>=PAGER_WRITER_CACHEMOD );
pPager->dbSize = nPage;