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

Unified Diff: third_party/sqlite/src/ext/fts5/test/fts5corrupt3.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months 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
Index: third_party/sqlite/src/ext/fts5/test/fts5corrupt3.test
diff --git a/third_party/sqlite/src/ext/fts5/test/fts5corrupt3.test b/third_party/sqlite/src/ext/fts5/test/fts5corrupt3.test
index dd70f31a6b5ad37429035e617326c9aa99c770f0..9653bcaac20a36c27714caff959fdc7fca0d18d6 100644
--- a/third_party/sqlite/src/ext/fts5/test/fts5corrupt3.test
+++ b/third_party/sqlite/src/ext/fts5/test/fts5corrupt3.test
@@ -179,6 +179,10 @@ for {set i 1} {1} {incr i} {
if {$end<=$i} break
lset var end [expr $end - $i]
set struct [binary format c* $var]
+
+ db close
+ sqlite3 db test.db
+
db eval {
BEGIN;
UPDATE t1_data SET block = $struct WHERE id=10;
@@ -334,12 +338,9 @@ do_catchsql_test 6.3.5 {
} {1 {database disk image is malformed}}
-}
-
#------------------------------------------------------------------------
#
reset_db
-reset_db
proc rnddoc {n} {
set map [list a b c d]
set doc [list]
@@ -371,6 +372,41 @@ do_test 7.1 {
}
} {}
+}
+
+#------------------------------------------------------------------------
+# Corruption within the structure record.
+#
+reset_db
+do_execsql_test 8.1 {
+ CREATE VIRTUAL TABLE t1 USING fts5(x, y);
+ INSERT INTO t1 VALUES('one', 'two');
+}
+
+do_test 9.1.1 {
+ set blob "12345678" ;# cookie
+ append blob "0105" ;# 1 level, total of 5 segments
+ append blob "06" ;# write counter
+ append blob "0002" ;# first level has 0 segments merging, 2 other.
+ append blob "450108" ;# first segment
+ execsql "REPLACE INTO t1_data VALUES(10, X'$blob')"
+} {}
+do_catchsql_test 9.1.2 {
+ SELECT * FROM t1('one AND two');
+} {1 {database disk image is malformed}}
+
+do_test 9.2.1 {
+ set blob "12345678" ;# cookie
+ append blob "0205" ;# 2 levels, total of 5 segments
+ append blob "06" ;# write counter
+ append blob "0001" ;# first level has 0 segments merging, 1 other.
+ append blob "450108" ;# first segment
+ execsql "REPLACE INTO t1_data VALUES(10, X'$blob')"
+} {}
+do_catchsql_test 9.2.2 {
+ SELECT * FROM t1('one AND two');
+} {1 {database disk image is malformed}}
+
sqlite3_fts5_may_be_corrupt 0
finish_test
« no previous file with comments | « third_party/sqlite/src/ext/fts5/test/fts5corrupt2.test ('k') | third_party/sqlite/src/ext/fts5/test/fts5detail.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698