diff --git a/src/sqlite3.c b/src/sqlite3.c index b1b1702f6ed80d132dced268dc476e733e0435ff..38bba871cc706a975c0042655919f187f0f9e8ad 100644 --- a/src/sqlite3.c +++ b/src/sqlite3.c @@ -151018,7 +151018,7 @@ static int whereKeyStats( #endif assert( pRec!=0 ); assert( pIdx->nSample>0 ); - assert( pRec->nField>0 && pRec->nField<=pIdx->nSampleCol ); + assert( pRec->nField>0 ); /* Do a binary search to find the first sample greater than or equal ** to pRec. If pRec contains a single field, the set of samples to search @@ -151064,7 +151064,7 @@ static int whereKeyStats( ** it is extended to two fields. The duplicates that this creates do not ** cause any problems. */ - nField = pRec->nField; + nField = MIN(pRec->nField, pIdx->nSample); iCol = 0; iSample = pIdx->nSample * nField; do{