diff --git a/src/sqlite3.c b/src/sqlite3.c index 83a40408856362ab57a931251db69b63ee17da43..127d86810828e47468d03f6b863ee531a6ce1bbe 100644 --- a/src/sqlite3.c +++ b/src/sqlite3.c @@ -152425,7 +152425,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 @@ -152471,7 +152471,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{