diff options
author | drh <> | 2021-10-27 23:55:30 +0000 |
---|---|---|
committer | drh <> | 2021-10-27 23:55:30 +0000 |
commit | eaad533e54083d4e06b1668e20023a27f620728d (patch) | |
tree | 3d42c7ed37ba61dca65934f84d2ba76a11027bf2 /src/wal.c | |
parent | 71c3ea7523498f127da538b0f7cc9709adc7c381 (diff) | |
download | sqlite-eaad533e54083d4e06b1668e20023a27f620728d.tar.gz sqlite-eaad533e54083d4e06b1668e20023a27f620728d.zip |
Ensure that all possible outcomes for walIndexPage() are accounted for by
callers.
FossilOrigin-Name: 12715c6b234a04627ca27e94bfa8bd456998360a9f0117480e0038f4747818d6
Diffstat (limited to 'src/wal.c')
-rw-r--r-- | src/wal.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1013,7 +1013,7 @@ static int walHashGet( rc = walIndexPage(pWal, iHash, &pLoc->aPgno); assert( rc==SQLITE_OK || iHash>0 ); - if( rc==SQLITE_OK ){ + if( pLoc->aPgno ){ pLoc->aHash = (volatile ht_slot *)&pLoc->aPgno[HASHTABLE_NPAGE]; if( iHash==0 ){ pLoc->aPgno = &pLoc->aPgno[WALINDEX_HDR_SIZE/sizeof(u32)]; @@ -1021,6 +1021,8 @@ static int walHashGet( }else{ pLoc->iZero = HASHTABLE_NPAGE_ONE + (iHash-1)*HASHTABLE_NPAGE; } + }else if( NEVER(rc==SQLITE_OK) ){ + rc = SQLITE_ERROR; } return rc; } @@ -1323,7 +1325,8 @@ static int walIndexRecover(Wal *pWal){ u32 iFirst = 1 + (iPg==0?0:HASHTABLE_NPAGE_ONE+(iPg-1)*HASHTABLE_NPAGE); u32 nHdr, nHdr32; rc = walIndexPage(pWal, iPg, (volatile u32**)&aShare); - if( rc ) break; + assert( aShare!=0 || rc!=SQLITE_OK ); + if( aShare==0 ) break; pWal->apWiData[iPg] = aPrivate; for(iFrame=iFirst; iFrame<=iLast; iFrame++){ |