mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-04 04:42:17 +03:00
Fix an off-by-one boundary-value issue in walCleanupHash().
FossilOrigin-Name: f039552e6330b6a04281748f985b41937f534bd0
This commit is contained in:
11
src/wal.c
11
src/wal.c
@@ -822,11 +822,16 @@ static void walCleanupHash(Wal *pWal){
|
||||
int iLimit; /* Zero values greater than this */
|
||||
|
||||
assert( pWal->writeLock );
|
||||
walHashFind(pWal, pWal->hdr.mxFrame+1, &aHash, &aPgno, &iZero);
|
||||
iLimit = pWal->hdr.mxFrame - iZero;
|
||||
if( iLimit>0 ){
|
||||
testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE-1 );
|
||||
testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE );
|
||||
testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE+1 );
|
||||
if( (pWal->hdr.mxFrame % HASHTABLE_NPAGE)>0 ){
|
||||
int nByte; /* Number of bytes to zero in aPgno[] */
|
||||
int i; /* Used to iterate through aHash[] */
|
||||
|
||||
walHashFind(pWal, pWal->hdr.mxFrame+1, &aHash, &aPgno, &iZero);
|
||||
iLimit = pWal->hdr.mxFrame - iZero;
|
||||
assert( iLimit>0 );
|
||||
for(i=0; i<HASHTABLE_NSLOT; i++){
|
||||
if( aHash[i]>iLimit ){
|
||||
aHash[i] = 0;
|
||||
|
Reference in New Issue
Block a user