diff --git a/src/sqlite3.c b/src/sqlite3.c index fb854a833172daa4d8f204cc8b15e2d68eaa61b6..3c5ecbdf388681e0617de49fe61c80f3c9ac1ce6 100755 --- 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{