Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: third_party/sqlite/fts3.patch

Issue 694353003: Get `gn gen` to succeed on Windows (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove GYP_DEFINES code Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/fts2.patch ('k') | third_party/sqlite/fts3_85522.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/fts3.patch
diff --git a/third_party/sqlite/fts3.patch b/third_party/sqlite/fts3.patch
new file mode 100644
index 0000000000000000000000000000000000000000..07fdb1a6afcb12b295146b5560dd8af558cd8f85
--- /dev/null
+++ b/third_party/sqlite/fts3.patch
@@ -0,0 +1,68 @@
+diff --git ext/fts3/fts3.c ext/fts3/fts3.c
+index 20da051..71e22ae 100644
+--- ext/fts3/fts3.c
++++ ext/fts3/fts3.c
+@@ -291,6 +291,7 @@
+ ** deletions and duplications. This would basically be a forced merge
+ ** into a single segment.
+ */
++#define CHROMIUM_FTS3_CHANGES 1
+
+ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+
+@@ -1226,7 +1227,13 @@ static int fts3ScanInteriorNode(
+ isFirstTerm = 0;
+ zCsr += sqlite3Fts3GetVarint32(zCsr, &nSuffix);
+
+- if( nPrefix<0 || nSuffix<0 || &zCsr[nSuffix]>zEnd ){
++ /* NOTE(shess): Previous code checked for negative nPrefix and
++ ** nSuffix and suffix overrunning zEnd. Additionally corrupt if
++ ** the prefix is longer than the previous term, or if the suffix
++ ** causes overflow.
++ */
++ if( nPrefix<0 || nSuffix<0 || nPrefix>nBuffer
++ || &zCsr[nSuffix]<zCsr || &zCsr[nSuffix]>zEnd ){
+ rc = SQLITE_CORRUPT;
+ goto finish_scan;
+ }
+@@ -3646,7 +3660,11 @@ int sqlite3Fts3Init(sqlite3 *db){
+ ** module with sqlite.
+ */
+ if( SQLITE_OK==rc
++#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST
++ /* fts3_tokenizer() disabled for security reasons. */
++#else
+ && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
++#endif
+ && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
+ && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
+ && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
+@@ -3656,11 +3674,15 @@ int sqlite3Fts3Init(sqlite3 *db){
+ rc = sqlite3_create_module_v2(
+ db, "fts3", &fts3Module, (void *)pHash, hashDestroy
+ );
++#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST
++ /* Disable fts4 pending review. */
++#else
+ if( rc==SQLITE_OK ){
+ rc = sqlite3_create_module_v2(
+ db, "fts4", &fts3Module, (void *)pHash, 0
+ );
+ }
++#endif
+ return rc;
+ }
+
+diff --git ext/fts3/fts3_icu.c ext/fts3/fts3_icu.c
+index 85390d3..a75b14a 100644
+--- ext/fts3/fts3_icu.c
++++ ext/fts3/fts3_icu.c
+@@ -198,7 +198,7 @@ static int icuNext(
+
+ while( iStart<iEnd ){
+ int iWhite = iStart;
+- U8_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c);
++ U16_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c);
+ if( u_isspace(c) ){
+ iStart = iWhite;
+ }else{
« no previous file with comments | « third_party/sqlite/fts2.patch ('k') | third_party/sqlite/fts3_85522.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698