diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 7 | ||||
-rw-r--r-- | src/build.c | 2 | ||||
-rw-r--r-- | src/prepare.c | 2 | ||||
-rw-r--r-- | src/util.c | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/src/btree.c b/src/btree.c index bfe554ff8..e61e4e605 100644 --- a/src/btree.c +++ b/src/btree.c @@ -5947,7 +5947,7 @@ static int allocateBtreePage( */ #ifndef SQLITE_OMIT_AUTOVACUUM if( eMode==BTALLOC_EXACT ){ - if( nearby<=mxPage ){ + if( ALWAYS(nearby<=mxPage) ){ u8 eType; assert( nearby>0 ); assert( pBt->autoVacuum ); @@ -6243,7 +6243,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ assert( CORRUPT_DB || iPage>1 ); assert( !pMemPage || pMemPage->pgno==iPage ); - if( iPage<2 || iPage>pBt->nPage ){ + if( iPage<2 || NEVER(iPage>pBt->nPage) ){ return SQLITE_CORRUPT_BKPT; } if( pMemPage ){ @@ -9143,8 +9143,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){ pgnoRoot==PENDING_BYTE_PAGE(pBt) ){ pgnoRoot++; } - assert( pgnoRoot>=3 || CORRUPT_DB ); - testcase( pgnoRoot<3 ); + assert( pgnoRoot>=3 ); /* Allocate a page. The page that currently resides at pgnoRoot will ** be moved to the allocated page (unless the allocated page happens diff --git a/src/build.c b/src/build.c index 97e9909e0..f52e2365b 100644 --- a/src/build.c +++ b/src/build.c @@ -2844,7 +2844,7 @@ void sqlite3RootPageMoved(sqlite3 *db, int iDb, Pgno iFrom, Pgno iTo){ static void destroyRootPage(Parse *pParse, int iTable, int iDb){ Vdbe *v = sqlite3GetVdbe(pParse); int r1 = sqlite3GetTempReg(pParse); - if( iTable<2 ) sqlite3ErrorMsg(pParse, "corrupt schema"); + if( NEVER(iTable<2) ) return; sqlite3VdbeAddOp3(v, OP_Destroy, iTable, r1, iDb); sqlite3MayAbort(pParse); #ifndef SQLITE_OMIT_AUTOVACUUM diff --git a/src/prepare.c b/src/prepare.c index c71400530..8e2186b10 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -159,7 +159,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){ }else if( sqlite3GetUInt32(argv[3],&pIndex->tnum)==0 || pIndex->tnum<2 - || (pIndex->tnum>pData->mxPage && pData->mxPage!=0) + || pIndex->tnum>pData->mxPage || sqlite3IndexHasDuplicateRootPage(pIndex) ){ if( sqlite3Config.bExtraSchemaChecks ){ diff --git a/src/util.c b/src/util.c index 8fbbcfd16..2371aad17 100644 --- a/src/util.c +++ b/src/util.c @@ -859,7 +859,7 @@ int sqlite3GetInt32(const char *zNum, int *pValue){ */ int sqlite3Atoi(const char *z){ int x = 0; - if( z ) sqlite3GetInt32(z, &x); + sqlite3GetInt32(z, &x); return x; } |