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

Fix a case where a corrupt database could cause an assert() to fail. (CVS 6496)

FossilOrigin-Name: 2c560e057e1da8a603efc36deea036f2392a4ab9
This commit is contained in:
danielk1977
2009-04-11 16:06:15 +00:00
parent 457e621e6e
commit e589a67f6c
4 changed files with 28 additions and 12 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.594 2009/04/10 09:47:07 danielk1977 Exp $
** $Id: btree.c,v 1.595 2009/04/11 16:06:15 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -4672,7 +4672,10 @@ static int clearCell(MemPage *pPage, unsigned char *pCell){
while( nOvfl-- ){
Pgno iNext = 0;
MemPage *pOvfl = 0;
if( ovflPgno==0 || ovflPgno>pagerPagecount(pBt) ){
if( ovflPgno<2 || ovflPgno>pagerPagecount(pBt) ){
/* 0 is not a legal page number and page 1 cannot be an
** overflow page. Therefore if ovflPgno<2 or past the end of the
** file the database must be corrupt. */
return SQLITE_CORRUPT_BKPT;
}
if( nOvfl ){