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

@ -1,5 +1,5 @@
C Reduce\sthe\sstack\susage\sof\sbalance_quick().\s(CVS\s6715)
D 2009-06-04T14:46:08
C If\sthe\sroot\spage\sof\sa\sbtree\sis\sempty\sand\sis\salso\snot\sa\sleaf\spage\sand\sthe\npage\sis\snot\spage\s1,\sthen\sreport\sdatabase\scorruption.\s(CVS\s6716)
D 2009-06-04T16:14:34
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 8b8fb7823264331210cddf103831816c286ba446
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -106,7 +106,7 @@ F src/auth.c 98db07c2088455797678eb1031f42d4d94d18a71
F src/backup.c ff50af53184a5fd7bdee4d620b5dabef74717c79
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
F src/btree.c ca83629673417074c919b9dc4a2003d69d52de9f
F src/btree.c ca21e0b459fa7c2984261d87c29a12806c1c89cd
F src/btree.h f70b694e8c163227369a66863b01fbff9009f323
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
F src/build.c 20e02fd72249159ff6829009f3029d16d59cdff5
@ -733,7 +733,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 453ff88f73a01a54ff464563effdb63014b1972c
R 10cf14b6134b53081d5b29cc87d78754
U danielk1977
Z ea544126f0e51edd041f5bf4bda237c8
P e7ad68e93b19b59cb16205c4b48fd9d6492dbb02
R ce07ddc07e08f5208711e118c4311660
U drh
Z 7df8641aaacbdb0452de8e950570f156

@ -1 +1 @@
e7ad68e93b19b59cb16205c4b48fd9d6492dbb02
52b02ca5f3e5fdf2f3e02e9d8e016028d0842818

@ -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 );