From 896da092c4debe2e865ccfbc94939aae2feda5fc Mon Sep 17 00:00:00 2001
From: Dan Kennedy <danielk1977@gmail.com>
Date: Mon, 28 Jan 2019 16:50:42 +0000
Subject: [PATCH 0858/1009] Fix a buffer overread in fts3 that could occur when
 accessing a corrupt database.

https://github.com/mackyle/sqlite/commit/896da092c4debe2e865ccfbc94939aae2feda5fc

---
 ext/fts3/fts3.c        |   1 +
 1 files changed, 1 insertions(+)

diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c
index 36e41d2..bd0003d 100644
--- a/ext/fts3/fts3.c
+++ b/ext/fts3/fts3.c
@@ -2810,6 +2810,7 @@ static int fts3TermSelectMerge(
     pTS->anOutput[0] = nDoclist;
     if( pTS->aaOutput[0] ){
       memcpy(pTS->aaOutput[0], aDoclist, nDoclist);
+      memset(&pTS->aaOutput[0][nDoclist], 0, FTS3_VARINT_MAX);
     }else{
       return SQLITE_NOMEM;
     }
-- 
1.8.3.1

