From 850b66a5848d73428951382ca909c3663b905a9e Mon Sep 17 00:00:00 2001
From: Dan Kennedy <danielk1977@gmail.com>
Date: Tue, 29 Jan 2019 11:42:43 +0000
Subject: [PATCH 0862/1009] Fix a buffer overrun triggered by a merge operation
 on a corrupt fts5 database.

https://github.com/mackyle/sqlite/commit/850b66a5848d73428951382ca909c3663b905a9e

---
 ext/fts5/fts5_index.c           |   2 +-
 1 files changed, 1 insertions(+), 1 deletion(-)

diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c
index cec4415..e1bb8d4 100644
--- a/ext/fts5/fts5_index.c
+++ b/ext/fts5/fts5_index.c
@@ -4145,7 +4145,7 @@ static void fts5TrimSegments(Fts5Index *p, Fts5Iter *pIter){
       u8 aHdr[4] = {0x00, 0x00, 0x00, 0x00};
 
       iLeafRowid = FTS5_SEGMENT_ROWID(iId, pSeg->iTermLeafPgno);
-      pData = fts5DataRead(p, iLeafRowid);
+      pData = fts5LeafRead(p, iLeafRowid);
       if( pData ){
         if( iOff>pData->szLeaf ){
           /* This can occur if the pages that the segments occupy overlap - if
-- 
1.8.3.1

