1 From c18bc2961fbb401a1941e736d81bd048c3b82e88 Mon Sep 17 00:00:00 2001
2 From: Scott Hess <shess@chromium.org>
3 Date: Tue, 16 Dec 2014 13:02:27 -0800
4 Subject: [PATCH 08/16] [fts3] Disable fts3_tokenizer and fts4.
6 fts3_tokenizer allows a SQLite user to specify a pointer to call as a
7 function, which has obvious sercurity implications. Disable fts4 until
8 someone explicitly decides to own support for it. Disable fts3tokenize
9 virtual table until someone explicitly decides to own support for it.
11 No original review URL because this was part of the initial Chromium commit.
13 third_party/sqlite/src/ext/fts3/fts3.c | 9 +++++++++
14 1 file changed, 9 insertions(+)
16 diff --git a/third_party/sqlite/src/ext/fts3/fts3.c b/third_party/sqlite/src/ext/fts3/fts3.c
17 index 2b93c62..dbd2835 100644
18 --- a/third_party/sqlite/src/ext/fts3/fts3.c
19 +++ b/third_party/sqlite/src/ext/fts3/fts3.c
21 ** query logic likewise merges doclists so that newer data knocks out
24 +#define CHROMIUM_FTS3_CHANGES 1
27 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
28 @@ -3828,7 +3829,11 @@ int sqlite3Fts3Init(sqlite3 *db){
29 ** module with sqlite.
32 +#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST
33 + /* fts3_tokenizer() disabled for security reasons. */
35 && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
37 && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
38 && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
39 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
40 @@ -3838,6 +3843,9 @@ int sqlite3Fts3Init(sqlite3 *db){
41 rc = sqlite3_create_module_v2(
42 db, "fts3", &fts3Module, (void *)pHash, hashDestroy
44 +#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST
45 + /* Disable fts4 and tokenizer vtab pending review. */
48 rc = sqlite3_create_module_v2(
49 db, "fts4", &fts3Module, (void *)pHash, 0
50 @@ -3846,6 +3854,7 @@ int sqlite3Fts3Init(sqlite3 *db){
52 rc = sqlite3Fts3InitTok(db, (void *)pHash);