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

Make the btree layer robust when faced with a corrupt database that

contains duplicate entries on the freelist.  Ticket #3209. (CVS 5392)

FossilOrigin-Name: 30825f74d60d8ace39bafd06814017ceefeb4fa4
This commit is contained in:
drh
2008-07-11 03:34:09 +00:00
parent fa67c3c584
commit 1013148b1c
6 changed files with 151 additions and 15 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.464 2008/07/10 00:32:42 drh Exp $
** @(#) $Id: pager.c,v 1.465 2008/07/11 03:34:10 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -4547,8 +4547,12 @@ void sqlite3PagerDontRollback(DbPage *pPg){
** has not been previously called during the same transaction.
** And if DontWrite() has previously been called, the following
** conditions must be met.
**
** (Later:) Not true. If the database is corrupted by having duplicate
** pages on the freelist (ex: corrupt9.test) then the following is not
** necessarily true:
*/
assert( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize );
/* assert( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize ); */
assert( pPager->pInJournal!=0 );
sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);