diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index 685492d0b7..8c4734e265 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -3087,6 +3087,35 @@ static void fts5IndexIntegrityCheckSegment( } fts5DataRelease(pLeaf); } + + /* There may (or may not be) a final entry in the doclist. The entry + ** is only present if the page following the nEmpty termless pages + ** (a) exists and (b) contains at least one rowid that is part of + ** the doclist. */ + if( dliter.pDlidx ){ + if( (iter.iLeaf + iter.nEmpty)==pSeg->pgnoLast ){ + /* The next page does not exist. So the iterator should be at EOF. */ + if( fts5IndexDoclistIterNext(&dliter)==0 ) p->rc = FTS5_CORRUPT; + }else{ + Fts5Data *pLeaf = fts5DataRead(p, iRow+i); + if( pLeaf ){ + int iRowidOff = fts5GetU16(&pLeaf->p[0]); + if( iRowidOff==0 ){ + if( fts5IndexDoclistIterNext(&dliter)==0 ) p->rc = FTS5_CORRUPT; + }else{ + if( fts5IndexDoclistIterNext(&dliter) ){ + p->rc = FTS5_CORRUPT; + }else{ + i64 iRowid; + getVarint(&pLeaf->p[iRowidOff], (u64*)&iRowid); + if( iRowid!=dliter.iRowid ) p->rc = FTS5_CORRUPT; + } + } + fts5DataRelease(pLeaf); + } + } + } + fts5DataRelease(dliter.pDlidx); } diff --git a/manifest b/manifest index ec7f134bbc..089486568e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\sthe\sfts5\sintegrity-check\sverify\sthat\sdoclist\sindexes\smatch\sthe\scontents\sof\sthe\sleaf\spages\sthat\sthey\sindex. -D 2014-08-01T19:27:07.492 +C Add\sa\sspecial\scase\sto\sthe\sintegrity-check\scode\sto\scheck\sthat\sthe\sfinal\sinteger\sin\sa\sdoclist\sindex\sis\sas\sexpected. +D 2014-08-01T20:13:49.462 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -110,7 +110,7 @@ F ext/fts5/fts5_aux.c 366057c7186bc3615deb5ecc0ff61de50b6d2dbc F ext/fts5/fts5_buffer.c 248c61ac9fec001602efc72a45704f3b8d367c00 F ext/fts5/fts5_config.c f4ebf143e141b8c77355e3b15aba81b7be51d710 F ext/fts5/fts5_expr.c e764d75c58a3accda795f1da1b45960ac87dc77a -F ext/fts5/fts5_index.c 3e33e3b86f026fc5b2cb3c573ba05375c8e4de0b +F ext/fts5/fts5_index.c 13f9dd9788f90c419ea33db0fcb2214c2f1290ef F ext/fts5/fts5_storage.c 2866e7e1de9dc851756c3a9c76b6e1d75e0facb7 F ext/fts5/fts5parse.y 777da8e5819f75c217982c79c29d014c293acac9 F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 @@ -1199,7 +1199,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 89377421ff69f2450364987afe781b6d8bcbf087 -R 49a5d37abb265ab7fa662e06ee8ea874 +P 37a7d3035eb4bbad7e32fe550321ac9fae611a57 +R 21856f96ed42128f5622f6977d9547a6 U dan -Z 90844fe42071f9a2a3f80f69e16c73d8 +Z 83c769d88a67f25fcdc4af671199630b diff --git a/manifest.uuid b/manifest.uuid index e25707dfd1..312136f109 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -37a7d3035eb4bbad7e32fe550321ac9fae611a57 \ No newline at end of file +c98934155cb48adfda57bd0fd1b950226d45f67a \ No newline at end of file