1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Fix an assert() that may be false for corrupt databases.

FossilOrigin-Name: b2ce5ed175cb5029ac07392ae371c86eeec23c74624aad007dee51cf359f3eeb
This commit is contained in:
dan
2019-04-22 11:47:40 +00:00
parent 1d2d71a02c
commit a9a5465eb4
4 changed files with 40 additions and 13 deletions

View File

@@ -4284,10 +4284,9 @@ int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
rc = newDatabase(pBt);
pBt->nPage = get4byte(28 + pBt->pPage1->aData);
/* The database size was written into the offset 28 of the header
** when the transaction started, so we know that the value at offset
** 28 is nonzero. */
assert( pBt->nPage>0 );
/* pBt->nPage might be zero if the database was corrupt when
** the transaction was started. Otherwise, it must be at least 1. */
assert( CORRUPT_DB || pBt->nPage>0 );
}
sqlite3BtreeLeave(p);
}