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

Detect when database corruption causes an attemp to set the pointer map

value for a pointer map page and report the corruption. (CVS 6722)

FossilOrigin-Name: 3ae4880bee3a0312c61cdd36f4fa50286cc2ef48
This commit is contained in:
drh
2009-06-05 18:44:15 +00:00
parent dda70fe38e
commit acfc72bea4
3 changed files with 11 additions and 8 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.618 2009/06/05 14:17:22 drh Exp $
** $Id: btree.c,v 1.619 2009/06/05 18:44:15 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -584,6 +584,9 @@ static int ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent){
return rc;
}
offset = PTRMAP_PTROFFSET(iPtrmap, key);
if( offset<0 ){
return SQLITE_CORRUPT_BKPT;
}
pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){