1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Initialize variables differently in the range processing logic of where.c

in order to make sure variables are always initialized even following
an OOM error.

FossilOrigin-Name: 3fb3686a4502140720dc3710a28a4f4128ab6554
This commit is contained in:
drh
2009-08-25 15:56:51 +00:00
parent 333ceb9389
commit 011cfca18e
3 changed files with 14 additions and 17 deletions

View File

@@ -2038,8 +2038,8 @@ static int whereRangeScanEst(
if( nEq==0 && p->aSample ){
int iEst;
int iUpper;
int iLower;
int iLower = 0;
int iUpper = SQLITE_INDEX_SAMPLES;
u8 aff = p->pTable->aCol[0].affinity;
if( pLower ){
@@ -2057,17 +2057,14 @@ static int whereRangeScanEst(
goto range_est_fallback;
}else if( pLowerVal==0 ){
rc = whereRangeRegion(pParse, p, pUpperVal, &iUpper);
iLower = pLower ? iUpper/2 : 0;
if( pLower ) iLower = iUpper/2;
}else if( pUpperVal==0 ){
rc = whereRangeRegion(pParse, p, pLowerVal, &iLower);
iUpper = pUpper ? (iLower + SQLITE_INDEX_SAMPLES + 1)/2
: SQLITE_INDEX_SAMPLES;
if( pUpper ) iUpper = (iLower + SQLITE_INDEX_SAMPLES + 1)/2;
}else{
rc = whereRangeRegion(pParse, p, pUpperVal, &iUpper);
if( rc==SQLITE_OK ){
rc = whereRangeRegion(pParse, p, pLowerVal, &iLower);
}else{
iLower = 0;
}
}