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

Fix two faulty assert() statements btree. (It was possible for the assertions

to be false given a corrupt database file as input.) (CVS 6872)

FossilOrigin-Name: 9403f04dfdabdd2ba9adb1a91ca9b400cf4ca6b3
This commit is contained in:
drh
2009-07-09 13:25:32 +00:00
parent 5cb0963fdc
commit 7157e1d2e5
3 changed files with 11 additions and 11 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.671 2009/07/09 11:36:02 danielk1977 Exp $
** $Id: btree.c,v 1.672 2009/07/09 13:25:32 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -1075,7 +1075,7 @@ static int defragmentPage(MemPage *pPage){
return SQLITE_CORRUPT_BKPT;
}
#endif
assert( cbrk+size<=usableSize && cbrk>iCellFirst );
assert( cbrk+size<=usableSize && cbrk>=iCellFirst );
testcase( cbrk+size==usableSize );
testcase( pc+size==usableSize );
memcpy(&data[cbrk], &temp[pc], size);
@@ -1126,7 +1126,7 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
gap = pPage->cellOffset + 2*pPage->nCell;
top = get2byte(&data[hdr+5]);
assert( gap<=top );
if( gap>top ) return SQLITE_CORRUPT_BKPT;
testcase( gap+2==top );
testcase( gap+1==top );
testcase( gap==top );