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

If the root page of a btree is empty and is also not a leaf page and the

page is not page 1, then report database corruption. (CVS 6716)

FossilOrigin-Name: 52b02ca5f3e5fdf2f3e02e9d8e016028d0842818
This commit is contained in:
drh
2009-06-04 16:14:33 +00:00
parent 6f235cc5de
commit c85240dbf6
3 changed files with 10 additions and 9 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.614 2009/06/04 14:46:08 danielk1977 Exp $
** $Id: btree.c,v 1.615 2009/06/04 16:14:34 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -3865,6 +3865,7 @@ static int moveToRoot(BtCursor *pCur){
if( pRoot->nCell==0 && !pRoot->leaf ){
Pgno subpage;
if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
assert( pRoot->pgno==1 );
subpage = get4byte(&pRoot->aData[pRoot->hdrOffset+8]);
assert( subpage>0 );