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:
@@ -1,5 +1,5 @@
|
||||
C Fix\stest\scases\sso\sthat\sthey\sall\sstill\swork\seven\swith\s-DSQLITE_DQS=0.
|
||||
D 2022-01-16T19:11:13.524
|
||||
C Never\sallow\sthe\sb-tree\slayers\sview\sof\sthe\snumber\sof\spages\sin\sthe\sdatabase\nfile\sexceed\sthe\sactual\snumber\sof\spages\sin\sthe\sdatabase\sfile,\seven\swhen\nPRAGMA\swriteable_schema=ON.\s\sThis\shelps\swith\searlier\sdetection\sof\scorruption,\nand\sprevents\sexcess\smemory\susage\sand\sCPU\scycles\sin\ssome\sintegrity_check\sops.
|
||||
D 2022-01-17T14:42:38.524
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -491,7 +491,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf
|
||||
F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
|
||||
F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d
|
||||
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
|
||||
F src/btree.c 9d9949b3faccdeab6261b30f75d2e5cf6aaf27be052df2f4e5d4b3dbaa6591f5
|
||||
F src/btree.c ddab31c38d5f16114bc68392430556b1063fe14e0020f9a56d2c35ddd58ba7e3
|
||||
F src/btree.h 74d64b8f28cfa4a894d14d4ed64fa432cd697b98b61708d4351482ae15913e22
|
||||
F src/btreeInt.h ee9348c4cb9077243b049edc93a82c1f32ca48baeabf2140d41362b9f9139ff7
|
||||
F src/build.c c72407a27a28982a384cd453a3a6b6992a1ceae8bd8d95e96d7fb9c0d645a32f
|
||||
@@ -538,7 +538,7 @@ F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c f5ad51cfd024116db8531feab9efd831c2621436dca1464e4ff1e8af9bf3252e
|
||||
F src/os_win.c 77d39873836f1831a9b0b91894fec45ab0e9ca8e067dc8c549e1d1eca1566fe9
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 5130bd602719ad9de1436def895da73973ee74382db02036be21238d0aa2ccfd
|
||||
F src/pager.c f6183fb7370425cd8642759693d9994649217cf7111caef89bc2c4946afbc36d
|
||||
F src/pager.h 4bf9b3213a4b2bebbced5eaa8b219cf25d4a82f385d093cd64b7e93e5285f66f
|
||||
F src/parse.y 04f61db1cdd7036c6d74baad1c342d3e3110cb0765c48fcfd3bdf4e974a1e5bb
|
||||
F src/pcache.c 084e638432c610f95aea72b8509f0845d2791293f39d1b82f0c0a7e089c3bb6b
|
||||
@@ -1938,8 +1938,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 092ad64faa4ae93b1e09ccd52159621d619e6817bcb4573331e9053d97f731fd
|
||||
R 3f20ad9a9f1d809380bd91f8dd5db646
|
||||
P 4883776669ee2f2310ea82b0d6df4d008eebaa7cb252102539cf21a635402ebb
|
||||
R 79b5483cfb0216197d9fed248f1ec5f0
|
||||
U drh
|
||||
Z f5dfc5249ab1cb55ce73ad103fb81155
|
||||
Z 126502bd3de79c968ac87da08f9189cd
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4883776669ee2f2310ea82b0d6df4d008eebaa7cb252102539cf21a635402ebb
|
||||
0407c8793700491b8519a649b9624f569b0e7e9b94d0db79d4a08139e0ecdb69
|
||||
+7
-3
@@ -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
|
||||
|
||||
+1
-2
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user