diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 6b9295e9bf..2ff9f04da8 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -1409,7 +1409,7 @@ static int fts3SegReaderNext( ** b-tree node. And that the final byte of the doclist is 0x00. If either ** of these statements is untrue, then the data structure is corrupt. */ - if( pReader->nDoclist-(pReader->aDoclist-pReader->aNode) > pReader->nNode + if( pReader->nDoclist > pReader->nNode-(pReader->aDoclist-pReader->aNode) || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1]) ){ return FTS_CORRUPT_VTAB; diff --git a/manifest b/manifest index a294b5b3ba..f616682088 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sthe\sCSV\sextension\swhen\sit\suses\sthe\s"header"\soption\son\na\sreal\sfile. -D 2018-12-26T12:50:47.591 +C Fix\sa\sproblem\swith\scorrupt\sfts3\sdatabase\sdetection\sintroduced\sby\s[95a9a39f]. +D 2018-12-26T14:15:09.334 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6 @@ -98,7 +98,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_unicode.c b1902e9ad47a6569fbb8ecb5ce52f20fe59b590d5c5e3bbdd56b10b03bdf632b F ext/fts3/fts3_unicode2.c e49f9e015f239bf5faf2f4fa483bbf1b08a9978f0ad1f31159d952f8b8a10d08 -F ext/fts3/fts3_write.c 6b00abe4d46ec31f49e2ea82ad14d7314e5dbfcf8afabde597fb9b0dff087375 +F ext/fts3/fts3_write.c e36d2f7e8f180e8030e92a5c2d09ccf87021afedcc5148a9d823b496667bf2f2 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73 @@ -912,7 +912,7 @@ F test/fts3conf.test c84bbaec81281c1788aa545ac6e78a6bd6cde2bdbbce2da261690e3659f F test/fts3corrupt.test 46b9ddda7f6588fd5a5b1f4bb4fc0618dc45010e7dddb8a3a188baf3197177ae F test/fts3corrupt2.test bf55c3fa0b0dc8ea1c0fe5543623bd27714585da6a129038fd6999fe3b0d25f3 F test/fts3corrupt3.test 0d5b69a0998b4adf868cc301fc78f3d0707745f1d984ce044c205cdb764b491f -F test/fts3corrupt4.test 789d97d9c7886c1c287cf51666061973b6cae04be5168a8d8b8bdc1a3fd20a8a +F test/fts3corrupt4.test eff323c4f93b211424d17f01ac6ace8772fbb712b5c9c578192cedd450023c4b F test/fts3cov.test cb932743da52a1c79a1ab8983e26c8121cf02263d6ff16e1f642e6f9b8348338 F test/fts3d.test 2bd8c97bcb9975f2334147173b4872505b6a41359a4f9068960a36afe07a679f F test/fts3defer.test f4c20e4c7153d20a98ee49ee5f3faef624fefc9a067f8d8d629db380c4d9f1de @@ -1794,7 +1794,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a1f50d57ce76f6c08a0ddbdd3c3fe2732d0e57dda14cb9aa3da00a14ceb4bc44 -R 88bb4ce4ac7ebee4335e3928cc9d3380 -U drh -Z 20b199b7dc2aeaeb36e18118518b333c +P 7acaed08f946633fca3ab8434dd6349ea6f1bac4fd9ec21f476db013ee06de30 +R ee97a6aaf4aa2e1aff9daa9fa7669c08 +U dan +Z 14bbf38704a1ec7efcc2bacf9ad5bb30 diff --git a/manifest.uuid b/manifest.uuid index f553683c8d..dc83950deb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7acaed08f946633fca3ab8434dd6349ea6f1bac4fd9ec21f476db013ee06de30 \ No newline at end of file +c80bb15b44e9b6a3c0c5a49d5e93e66376c3520ecefc1db7425c8a7e09d3eade \ No newline at end of file diff --git a/test/fts3corrupt4.test b/test/fts3corrupt4.test index 79077c238b..2718aefcf4 100644 --- a/test/fts3corrupt4.test +++ b/test/fts3corrupt4.test @@ -166,5 +166,87 @@ do_execsql_test 4.4 { INSERT INTO t1(t1) VALUES('optimize'); } +#------------------------------------------------------------------------- +reset_db +do_test 5.0 { + sqlite3 db {} + db deserialize [decode_hexdb { +| size 24576 pagesize 4096 filename c15.db +| page 1 offset 0 +| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. +| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 04 .....@ ........ +| 32: 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 04 ................ +| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................ +| 96: 00 00 00 00 0d 0e f9 00 06 0d ec 00 0f cd 0f 69 ...............i +| 112: 0f 01 0e 10 0e c6 0d ec 00 00 00 00 00 00 00 00 ................ +| 3552: 00 00 00 00 00 00 00 00 00 00 00 00 22 06 06 17 ................ +| 3568: 11 11 01 31 74 61 62 6c 65 74 32 74 32 06 43 52 ...1tablet2t2.CR +| 3584: 45 41 54 45 20 54 41 42 4c 45 20 74 32 28 78 29 EATE TABLE t2(x) +| 3600: 81 33 04 07 17 1f 1f 01 82 35 74 61 62 6c 65 74 .3.......5tablet +| 3616: 31 5f 73 65 67 64 69 72 74 31 5f 73 65 67 64 69 1_segdirt1_segdi +| 3632: 72 04 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 r.CREATE TABLE ' +| 3648: 74 31 5f 73 65 67 64 69 72 27 28 6c 65 76 65 6c t1_segdir'(level +| 3664: 20 49 4e 54 45 47 45 52 2c 69 64 78 20 49 4e 54 INTEGER,idx INT +| 3680: 45 47 45 52 2c 73 74 61 72 74 5f 62 6c 6f 63 6b EGER,start_block +| 3696: 20 49 4e 54 45 47 45 52 2c 6c 65 61 76 65 73 5f INTEGER,leaves_ +| 3712: 65 6e 64 5f 62 6c 6f 63 6b 20 49 4e 54 45 47 45 end_block INTEGE +| 3728: 52 2c 65 6e 64 5f 62 6c 6f 63 6b 20 49 4e 54 45 R,end_block INTE +| 3744: 47 45 52 2c 72 6f 6f 74 20 42 4c 4f 42 2c 50 52 GER,root BLOB,PR +| 3760: 49 4d 41 52 59 20 4b 45 59 28 6c 65 76 65 6c 2c IMARY KEY(level, +| 3776: 20 69 64 78 29 29 31 05 06 17 45 1f 01 00 69 6e idx))1...E...in +| 3792: 64 65 78 73 71 6c 69 74 65 5f 61 75 74 6f 69 6e dexsqlite_autoin +| 3808: 64 65 79 5f 74 31 5f 73 65 67 64 69 72 5f 31 74 dey_t1_segdir_1t +| 3824: 31 5f 73 65 67 64 69 72 05 00 00 00 08 00 00 00 1_segdir........ +| 3840: 00 66 03 07 17 23 23 01 81 13 74 61 62 6c 65 74 .f...##...tablet +| 3856: 31 5f 73 65 67 6d 65 6e 74 73 74 31 5f 73 65 67 1_segmentst1_seg +| 3872: 6d 65 6e 74 73 03 43 52 45 41 54 45 20 54 41 42 ments.CREATE TAB +| 3888: 4c 45 20 27 74 31 5f 73 65 67 6d 65 6e 74 73 27 LE 't1_segments' +| 3904: 28 62 6c 6f 63 6b 69 64 20 49 4e 54 45 47 45 52 (blockid INTEGER +| 3920: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 62 6c PRIMARY KEY, bl +| 3936: 6f 63 6b 20 42 4c 4f 42 29 62 02 07 17 21 21 01 ock BLOB)b...!!. +| 3952: 81 0f 74 61 62 6c 65 74 31 5f 63 6f 6e 74 65 6e ..tablet1_conten +| 3968: 74 74 31 5f 63 6f 6e 74 65 6e 74 02 43 52 45 41 tt1_content.CREA +| 3984: 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63 6f 6e TE TABLE 't1_con +| 4000: 74 65 6e 74 27 28 64 6f 63 69 64 20 49 4e 54 45 tent'(docid INTE +| 4016: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c GER PRIMARY KEY, +| 4032: 20 27 63 30 63 6f 6e 74 65 6e 74 27 29 31 01 06 'c0content')1.. +| 4048: 17 11 11 08 51 74 61 62 6c 65 74 31 74 31 43 52 ....Qtablet1t1CR +| 4064: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB +| 4080: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33 LE t1 USING fts3 +| page 2 offset 4096 +| 0: 0d 00 00 00 03 0f e0 00 0f f6 0f ec 0f e0 00 00 ................ +| 4064: 0a 03 03 00 1b 61 62 61 6e 64 6f 6e 08 02 03 00 .....abandon.... +| 4080: 17 61 62 61 66 74 08 01 03 00 17 61 62 61 63 6b .abaft.....aback +| page 3 offset 8192 +| 0: 0d 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 ................ +| page 4 offset 12288 +| 0: 0d 00 00 00 01 0f d6 00 0f d6 00 00 00 00 00 00 ................ +| 4048: 00 00 00 00 00 00 28 01 07 08 08 08 08 15 46 30 ......(.......F0 +| 4064: 20 32 39 00 05 61 62 61 63 6b 03 01 02 00 03 02 29..aback...... +| 4080: 66 74 03 02 02 00 03 04 6e 64 6f 60 30 30 20 00 ft......ndo`00 . +| page 5 offset 16384 +| 0: a0 00 00 00 10 ff b0 00 ff fb 00 00 00 00 00 00 ................ +| 4080: 00 00 00 00 00 00 00 00 00 00 00 04 04 08 08 09 ................ +| page 6 offset 20480 +| 0: 0d 00 00 00 05 0f b8 00 0f f4 0f e9 0f d6 0f c7 ................ +| 16: 0f b8 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 ..'t1_content'(d +| 32: 6f 63 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 ocid INTEGER PRI +| 48: 4d 41 52 59 20 4b 45 59 2c 20 27 63 30 63 6f 6e MARY KEY, 'c0con +| 64: 74 65 6e 74 27 29 31 01 06 17 11 11 08 51 74 61 tent')1......Qta +| 80: 62 6c 65 74 31 74 31 43 52 45 41 54 45 20 56 49 blet1t1CREATE VI +| 96: 52 54 55 41 4c 20 54 41 42 4c 45 20 74 31 20 55 RTUAL TABLE t1 U +| 112: 53 49 4e 47 20 66 74 73 33 0d 00 00 00 03 0f e0 SING fts3....... +| 128: 00 0f f6 0f ec 0f e0 00 00 00 00 00 00 00 00 00 ................ +| 4016: 00 00 00 00 00 00 00 00 0d 05 02 23 61 75 74 6f ...........#auto +| 4032: 6d 65 72 67 65 3d 35 0d 04 02 23 6d 65 72 67 65 merge=5...#merge +| 4048: 3d 31 30 30 2c 38 11 03 02 2b 69 6e 74 65 67 72 =100,8...+integr +| 4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62 ity-check....reb +| 4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 uild....optimize +| end c15.db +}]} {} + +do_catchsql_test 5.1 { + SELECT * FROM t1 WHERE t1 MATCH 'abandon'; +} {1 {database disk image is malformed}} finish_test