Detect database corruption and abort balance_nonroot() before the
corruption causes problems. (CVS 6758) FossilOrigin-Name: 3448b39dcd580880a9326414e7e4952c4fbc313d
This commit is contained in:
parent
c53eed1703
commit
eac74428c1
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Change\slemon\sso\sthat\sit\sdoes\snot\sgenerate\syytestcase()\smacros\son\sdestructor\ncases\ssince\sdestructors\sare\scommonly\sunreachable\sin\sa\sreasonable\sgrammar.\nFor\sthe\sreduce-rule\sswitch,\sgather\sall\sno-ops\sinto\sthe\s"default:"\scase.\s(CVS\s6757)
|
||||
D 2009-06-12T17:46:20
|
||||
C Detect\sdatabase\scorruption\sand\sabort\sbalance_nonroot()\sbefore\sthe\ncorruption\scauses\sproblems.\s(CVS\s6758)
|
||||
D 2009-06-14T12:47:11
|
||||
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 b883af5a932982547989a23187ffae5283dfd804
|
||||
F src/btree.c 9804315e03b017fdefabecbba7ac02f6b0fd38a9
|
||||
F src/btree.h f70b694e8c163227369a66863b01fbff9009f323
|
||||
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
|
||||
F src/build.c 6c7b96103cebc558710ae72e2ce99b91c8ccd961
|
||||
@ -734,7 +734,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
|
||||
P a5b182f93b9e57754c8b9507cf491a7bbf0fd127
|
||||
R 487e6d753f4accfc816b85167f6e8a2b
|
||||
P caebfe82cb1b1215a85ed48fe97360c5422c52e0
|
||||
R 588f8db63f5f28d8703158124d3cf94d
|
||||
U drh
|
||||
Z 44d7634c369a18c617752b13ad1a8da2
|
||||
Z abc3880a9e9a25c04c64068e2ef754ae
|
||||
|
@ -1 +1 @@
|
||||
caebfe82cb1b1215a85ed48fe97360c5422c52e0
|
||||
3448b39dcd580880a9326414e7e4952c4fbc313d
|
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.626 2009/06/10 09:11:06 danielk1977 Exp $
|
||||
** $Id: btree.c,v 1.627 2009/06/14 12:47:11 drh Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** See the header comment on "btreeInt.h" for additional information.
|
||||
@ -5546,6 +5546,7 @@ static int balance_nonroot(MemPage *pParent, int iParentIdx, u8 *aOvflSpace){
|
||||
if( leafData ){ i--; }
|
||||
subtotal = 0;
|
||||
k++;
|
||||
if( k>NB+1 ){ rc = SQLITE_CORRUPT; goto balance_cleanup; }
|
||||
}
|
||||
}
|
||||
szNew[k] = subtotal;
|
||||
@ -5592,7 +5593,10 @@ static int balance_nonroot(MemPage *pParent, int iParentIdx, u8 *aOvflSpace){
|
||||
/*
|
||||
** Allocate k new pages. Reuse old pages where possible.
|
||||
*/
|
||||
assert( apOld[0]->pgno>1 );
|
||||
if( apOld[0]->pgno<=1 ){
|
||||
rc = SQLITE_CORRUPT;
|
||||
goto balance_cleanup;
|
||||
}
|
||||
pageFlags = apOld[0]->aData[0];
|
||||
for(i=0; i<k; i++){
|
||||
MemPage *pNew;
|
||||
|
Loading…
Reference in New Issue
Block a user