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

Fix a segfault that can occur when running integrity_check on a corrupt db. (CVS 5606)

FossilOrigin-Name: eae959ede1b2b50190c60de9249cf141c3031ce2
This commit is contained in:
danielk1977
2008-08-25 11:57:16 +00:00
parent 8c20014a0a
commit daca5433a0
3 changed files with 12 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.502 2008/08/23 16:17:56 danielk1977 Exp $
** $Id: btree.c,v 1.503 2008/08/25 11:57:17 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -6758,8 +6758,11 @@ static int checkTreePage(
cellStart = hdr + 12 - 4*pPage->leaf;
for(i=0; i<nCell; i++){
int pc = get2byte(&data[cellStart+i*2]);
u16 size = cellSizePtr(pPage, &data[pc]);
u16 size = 1024;
int j;
if( pc<=usableSize ){
size = cellSizePtr(pPage, &data[pc]);
}
if( (pc+size-1)>=usableSize || pc<0 ){
checkAppendMsg(pCheck, 0,
"Corruption detected in cell %d on page %d",i,iPage,0);