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

Fix a potential database corruption following DROP TABLE when the pending

byte page corresponds to a ptrmap page.  This situation cannot happen in
a real deployment - but it still needs to be fixed. (CVS 6897)

FossilOrigin-Name: 6242db39f7f4ead5017bf684139d1f8312799f81
This commit is contained in:
drh
2009-07-15 18:15:22 +00:00
parent 4c301aaca8
commit e184965d7e
3 changed files with 10 additions and 12 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.689 2009/07/15 17:25:46 drh Exp $
** $Id: btree.c,v 1.690 2009/07/15 18:15:23 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -6976,10 +6976,8 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
** PENDING_BYTE_PAGE.
*/
maxRootPgno--;
if( maxRootPgno==PENDING_BYTE_PAGE(pBt) ){
maxRootPgno--;
}
if( maxRootPgno==PTRMAP_PAGENO(pBt, maxRootPgno) ){
while( maxRootPgno==PENDING_BYTE_PAGE(pBt)
|| PTRMAP_ISPAGE(pBt, maxRootPgno) ){
maxRootPgno--;
}
assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) );