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

Detect an attempt to drop a btree that is not within the bounds of the

database file and abort early with an SQLITE_CORRUPT error, to avoid
problems later on in the process.

FossilOrigin-Name: 235a9698f5e9b3c21dc51c9c5042becfb82fc1762a7519a46b9f9fdafe9b0f13
This commit is contained in:
drh
2019-03-08 01:52:30 +00:00
parent 39c5c4ae06
commit 9a518843f5
3 changed files with 10 additions and 7 deletions

View File

@@ -9268,6 +9268,9 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
assert( sqlite3BtreeHoldsMutex(p) );
assert( p->inTrans==TRANS_WRITE );
assert( iTable>=2 );
if( iTable>btreePagecount(pBt) ){
return SQLITE_CORRUPT_BKPT;
}
rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);
if( rc ) return rc;