Ensure that the pcache1 cache size does not get so big that it overflows
the integer that is keeping track of the cache size. FossilOrigin-Name: bf9d70fc2fde06a3f132270a26d4abe321687169066aff26ad9e92757c7f9ee4
This commit is contained in:
+4
-1
@@ -820,6 +820,9 @@ static void pcache1Cachesize(sqlite3_pcache *p, int nMax){
|
||||
if( pCache->bPurgeable ){
|
||||
PGroup *pGroup = pCache->pGroup;
|
||||
pcache1EnterMutex(pGroup);
|
||||
if( nMax > 0xffff0000 - pGroup->nMaxPage + pCache->nMax ){
|
||||
nMax = 0xffff0000 - pGroup->nMaxPage + pCache->nMax;
|
||||
}
|
||||
pGroup->nMaxPage += (nMax - pCache->nMax);
|
||||
pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
|
||||
pCache->nMax = nMax;
|
||||
@@ -838,7 +841,7 @@ static void pcache1Shrink(sqlite3_pcache *p){
|
||||
PCache1 *pCache = (PCache1*)p;
|
||||
if( pCache->bPurgeable ){
|
||||
PGroup *pGroup = pCache->pGroup;
|
||||
int savedMaxPage;
|
||||
unsigned int savedMaxPage;
|
||||
pcache1EnterMutex(pGroup);
|
||||
savedMaxPage = pGroup->nMaxPage;
|
||||
pGroup->nMaxPage = 0;
|
||||
|
||||
Reference in New Issue
Block a user