Change the way a comparison used to detect corrupt databases in fts3 is done

to avoid potential pointer overflow in 32-bit builds.

FossilOrigin-Name: 95a9a39ff784b960b62dd6298e722a620ba3f9c8b76839a49bbef35d7bc84a8e
This commit is contained in:
dan
2018-12-24 13:34:36 +00:00
parent 85bcdce270
commit 29e9af8848
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -1409,7 +1409,7 @@ static int fts3SegReaderNext(
** b-tree node. And that the final byte of the doclist is 0x00. If either
** of these statements is untrue, then the data structure is corrupt.
*/
if( (&pReader->aNode[pReader->nNode] - pReader->aDoclist)<pReader->nDoclist
if( pReader->nDoclist-(pReader->aDoclist-pReader->aNode) > pReader->nNode
|| (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])
){
return FTS_CORRUPT_VTAB;