Commit Graph

591 Commits

Author SHA1 Message Date
dan
fc7f31742d Fix an integer overflow in fts3 causing a usan error.
FossilOrigin-Name: e256f85289a78e629acdf83e5bf1f8df2a0ffb3d559738eb9e49db6c228dc8c0
2020-04-22 11:11:17 +00:00
dan
7576a68c8c Improve corruption detection in fts3 shadow tables earlier in order to prevent an assert() from failing.
FossilOrigin-Name: a9ec8c8f80a59badabb0afdb4189f0fd2934f936530d4151de395b3a7e7c1f1f
2020-04-16 11:35:27 +00:00
dan
ec8e689a20 Avoid an undefined integer overflow in fts3 by detecting data structure corruption earlier.
FossilOrigin-Name: 86e98ddc19470410ccc6d2cf4ad56ef0bc5a23b7fbe6331b8cae374689f54529
2020-03-20 20:18:49 +00:00
drh
b3f0d92b91 Improved detection of corruption in the interior nodes of a segment btree
in FTS3/4.

FossilOrigin-Name: cc99447ac923166104e8a7c75088ed95279f4491b30cfa37dc3ee5e005dd9fac
2020-03-03 01:16:04 +00:00
dan
fcbc673752 Fix some fts3 problems found by usan.
FossilOrigin-Name: fb7ccf61bed8d862986eda7096bec3df5947f1d1c88f27e7d9c8acf420f40c50
2020-02-06 10:55:10 +00:00
drh
32d184e049 Only register the fts3_tokenizer() function using a single text encoding.
FossilOrigin-Name: 966964af1021feebc56cfda7b08bc787be7f447d682299f7958463aca30a73af
2020-01-09 20:33:36 +00:00
dan
262efe4a43 Fix an instance of an undefined behaviour (a left-shift of a 64-bit unsigned integer by a value greater than 64) that could occur in fts3.
FossilOrigin-Name: e1f12978b53683114ab0ef0e84a14dd4fabc72750b214aac19cd9da22a582a27
2020-01-07 09:06:43 +00:00
dan
e455e3acf0 In fts3, avoid making a very large memory allocation if the merge-hint record is corrupt.
FossilOrigin-Name: 9add58fe9688d5c1f675736e7f1c6ff7831d2ff6fdeb884a2e62c1bf9536ee50
2020-01-03 20:16:32 +00:00
drh
1e732787da Set the SQLITE_DIRECTONLY flag on the fts3_tokenizer() function of FTS3,
thus preventing that function from being called from within a trigger or
view.

FossilOrigin-Name: f3171dc22e4d3a40ca17fe609391d92fc6a997b775bfefa5947aec69c889aa73
2019-12-31 18:12:36 +00:00
dan
e88af0179e Fix a spurious report of corruption from the fts3/4 integrity-check triggered by using the languageid option.
FossilOrigin-Name: 70815e273f511481c310dc33b3b49079901d891078fad49b663fbce06c77ecc2
2019-12-21 20:43:34 +00:00
drh
b2ab3dcff0 Fix harmless compiler warnings.
FossilOrigin-Name: 2bbd014c900e0d71fd30ec647739b82c5dc3aa237a0203f5a1db50593dae199e
2019-12-20 14:08:34 +00:00
dan
5be1b20aec Fix problems in fts3 with processing corrupt records and undefined integer overflows.
FossilOrigin-Name: 3b873029ef1903f76442445343af3786cd59ee66b0e5e0e6b76a0b6b1b5eb88a
2019-12-14 14:15:21 +00:00
dan
8aa706e748 Fix a buffer overread that could occur in fts3 with corrupt %_stat records.
FossilOrigin-Name: e01fdbf9f700e1bd9dd5283c65547d10d26ce4f4506d3cfef9e1087aecdc2305
2019-12-04 03:46:50 +00:00
drh
d79967adbe Avoid a harmless zero offset of a null pointer in FTS3, so as to not provoke
unnecessary warnings from run-time checkers.

FossilOrigin-Name: 85d95abec4a596eb3ffd2ea19b4067dc1a6970264222ed5d69e75764ac21597c
2019-12-03 03:31:11 +00:00
drh
51690f26bc Fix to check-in [5d9a369301a65f32] so that it compiles without SQLITE_DEBUG.
FossilOrigin-Name: fefe2d046725254367f9f82a8c8cb137e8b75dbbf4bc48debf0649479ff2f0c2
2019-11-26 11:10:59 +00:00
dan
597f1eb195 Fix an assert() in fts3 that could fail due to corrupt database records.
FossilOrigin-Name: 5d9a369301a65f320a0696fcf1f062ca5976ef34350590c07aecf5335c66d872
2019-11-26 02:03:16 +00:00
dan
6637332988 Prevent direct and indirect recursive content= options in fts3/4 and fts5.
FossilOrigin-Name: 2eb997327c2c369c10b7835be80112d77cb2a7cfa9fe4d564042984c21d94698
2019-11-21 14:20:59 +00:00
dan
70d1a1a3ed Further improve detection of corrupt records in fts3.
FossilOrigin-Name: a0f6d526baecd061a5e2bec5eb698fb5dfb10122ac79c853d7b3f4a48bc9f49b
2019-11-20 13:31:52 +00:00
drh
804725a6b9 Improvements to detection of corruption in the %_stat shadow table of FTS4.
FossilOrigin-Name: 6b67eba54e7b4887a8cdab7537b12a95e9f17bcdaa0b423af5ed5bd91f69f2c6
2019-11-18 14:04:21 +00:00
drh
13a8f203d9 Further improvements to shadow table corruption detection in FTS3.
FossilOrigin-Name: e35d8c76aae59f57cc5193f79b21b4298029bea78e1aab7af67432162ce63e00
2019-11-18 12:04:17 +00:00
drh
3e72bdb5fe Detect and prevent infinite recursion in fts3SelectLeaf() due to a
malformed FTS3 btree.

FossilOrigin-Name: dfcf081d842629a0b177be7eb2eb8ce719324068991040a581e33ea1d5db3d27
2019-11-18 11:14:59 +00:00
drh
19d4175d65 Improved detection of corruption in the %_stat table of FTS4.
Chromium ticket 1025467.

FossilOrigin-Name: 10f8a3b718e0f47be528fba086c318e1dfe18ead383d01cfa24dedabad41e0a2
2019-11-18 10:37:57 +00:00
drh
feb5dcf1a6 Better detection of corruption in the %_stat and %_docsize shadow tables
of FTS3.

FossilOrigin-Name: 1e449687881f4d388e54a0e51bcabba41ab10cf7e596ff65e31e88a23c70d497
2019-11-17 02:41:06 +00:00
drh
fd6bf04bba Remove a reachable NEVER() in FTS3.
FossilOrigin-Name: 8bd75bf636f72f32d66c6c38e1918f27daf2f13290f00a001f41d50838bbda47
2019-11-17 00:08:24 +00:00
drh
c72f2fb7fe More improvements to shadow table corruption detection in FTS3.
FossilOrigin-Name: 51525f9c3235967bc00a090e84c70a6400698c897aa4742e817121c725b8c99d
2019-11-16 23:47:40 +00:00
drh
94febb3a77 Improved detection of corrupt shadow tables in FTS3. Enable the debugging
special-inserts for FTS3 for both SQLITE_DEBUG and SQLITE_TEST.

FossilOrigin-Name: 04b2873be5aedeb1c4325cf36c4b5d180f929a641caf1e3829c03778adb29c8e
2019-11-16 21:40:49 +00:00
dan
b1c479b61d Fix an fts3 assert() that could fail when operating on a database containing corrupt records.
FossilOrigin-Name: 7c52f5478f9ecf5c078208759143ae9de43c1bf191dfcd74acb8bd169d4dc883
2019-11-01 13:37:26 +00:00
dan
9930cfe878 Fix a problem in fts3 causing it to report corruption if a doclist contains consectutive rowid entries that differ by more than 2^63.
FossilOrigin-Name: 0b0a3048f9df88bbc8979f2ac5247bee7d7bc1e585faca252610d2fcbe36d51d
2019-10-28 13:54:59 +00:00
dan
b2075011a7 Avoid an infinite loop in fts3/4 incremental-merge in the case where the lowest level in the database contains segments but no data (because there is a delete-marker for each valid entry). Fix for [bf1aab89].
FossilOrigin-Name: 35beaee059a6cccead4311886ca928d936f23584cf435e35e265e98feea723dc
2019-10-17 15:41:36 +00:00
dan
8b4d0e2cba Ensure fts3/4 prefix indexes are flushed to disk before an 'optimize' command. Fix for [745f1abc].
FossilOrigin-Name: 4ed905b18847d4dbf5a2570052abced338065f824137b90300f62d77b3159d80
2019-10-11 15:33:13 +00:00
dan
9613c9f4a6 Fix the fts3/4 integrity-check command so that it works with "ORDER=DESC" tables. Fix for [8a6fa2bb].
FossilOrigin-Name: 5863546df99abd1ad4ebcaba18dec647be4368e2c13ce0b28e48c8608d3e87ef
2019-10-11 14:27:17 +00:00
dan
cd79010964 Fix a problem in the fts3 integrity-check routine causing it to report as corrupt tables that contain values with embedded 0x00 bytes.
FossilOrigin-Name: 629e20c9880acc2cb9e2fa6da39a15a90483e9a8f433df29d285c23bdfb03b0b
2019-10-10 16:41:44 +00:00
dan
23d3f5d661 Fix a long-standing problem in fts4 incrmental merge.
FossilOrigin-Name: 67da31e24ebb49c4cac81c9e7cfca37ca422555fd0fdb01d8f180890783c84ff
2019-10-02 19:33:34 +00:00
drh
5e81e9fdae The nodeReaderInit() function in FTS3 may not assume that the node is
non-empty.

FossilOrigin-Name: 361eb2f682a303bba72b39d322d9de630494ca044fe0508dcb23b6130d312d85
2019-09-30 19:13:31 +00:00
drh
5c0666d9e3 In FTS3/4, the poslist end marker must be larger than any other possible
poslist value, even on a corrupt poslist.

FossilOrigin-Name: 752679aea5a6bbde24cbf39e2fa018f7dd1c226d463ca4bd74125303b2255170
2019-09-28 11:19:56 +00:00
dan
14e3e22773 Fix an assert() in fts3 that could fail when accessing a corrupt database.
FossilOrigin-Name: 601ce9532d34f97a5faa170b6d8a272e5c54f2eabff84660201a1840e0fd9929
2019-09-19 13:51:52 +00:00
dan
572b0dddee Add extra tests for the handling of corrupt records in fts3.
FossilOrigin-Name: 40e29a47d1266c16a4992e43579a51addcc632503099c4cd128f77dd4e67da3c
2019-09-18 17:22:00 +00:00
dan
6fcb9f3ad9 Fix a broken assert() in the fts3 snippet code that was failing for queries containging more than 64 phrases.
FossilOrigin-Name: 4c01e0170e113ad052b6c3980beb4be9f1dc03fb3cf34132b90e8b82b23f654e
2019-08-21 11:31:48 +00:00
dan
8279fe8a4b Fix a crash in fts3 caused by corrupt database records.
FossilOrigin-Name: 11f7f94f1c5d761e7f381e277658b7e857cc369283996c509061de55fd6aad52
2019-07-29 16:53:30 +00:00
dan
7d840e530f Fix a valgrind problem in fts3corrupt4.test.
FossilOrigin-Name: cb3dec427e399064eeec31c15565346f045bd7c46d2f7860b1cd346bbcccb124
2019-07-05 15:16:22 +00:00
dan
471e88f732 Fix a segfault in fts3 that could occur when processing corrupt fts records.
FossilOrigin-Name: dff24c6c7a4e7623984b5bb24c2ff14fe079dc49a0ad048cbfc66f84c08875b0
2019-06-04 13:11:37 +00:00
dan
efdb371a1d Fix an assert() in fts3 that could fail when processing corrupt records. Also some minor sanitizer warnings.
FossilOrigin-Name: c736c40aab071a69bd5c5347b7c116d87ea3954019e967ca8ff7bdb4b518e5bf
2019-05-28 14:42:32 +00:00
dan
29fa6b6642 Fix a buffer overread that could in fts3 when dealing with corrupt records.
FossilOrigin-Name: 1660d7733eb443ab085ddef7666b998a1c75ac81cc54a9620960a8d3b377e28e
2019-05-22 14:22:44 +00:00
dan
bebea908b8 Fix another instance in fts3 where a corrupt record can cause a buffer overflow.
FossilOrigin-Name: e1724f1d618cfbcfd1e495d8965a395656cfc1114e1bffd4bc3be0bd5cdb6550
2019-04-24 16:13:52 +00:00
dan
04687f9e03 Fix an error in fts3_write.c allowing a corrupt database to cause a crash.
FossilOrigin-Name: 6e4a5f22811bcd1485e27073ec96821d448b91b6d1ff1659cc3772449d19a762
2019-04-24 15:13:02 +00:00
drh
766b431ab9 Fix a harmless compiler warning in test logic.
FossilOrigin-Name: c3932e66040bf4c82727a26a976291fab219e8bc8a6d7579e19304538cc6df18
2019-04-13 16:50:21 +00:00
drh
73f940c89e Fix additional compiler warnings introduced by the previous check-in and found
by MSVC.

FossilOrigin-Name: 6fc0deffa4eed902fd13eefe6d2765f338f3dadc5b29f7cae5064e135417746b
2019-04-13 14:17:09 +00:00
drh
f6ad201ac2 Fixes for harmless compiler warnings.
FossilOrigin-Name: c28c973ad6debd63f13e5d4d3da036f680baaec9d863eda039f2747db9f1cfd5
2019-04-13 14:07:57 +00:00
drh
3b574e4ea9 Use the 64-bit memory allocator interfaces in extensions, whenever possible.
FossilOrigin-Name: 07ee06fd390bfebebc014b47583d489747b0423bb96c810bed5c605ce0e3be71
2019-04-13 04:38:32 +00:00
drh
7678fdc33d Change the fts3_tokenizer() function to always return the pointer as a BLOB
as long as the first argument is a bound parameter, regardless of the
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER setting.

FossilOrigin-Name: 27160df7b3a04ac59d06013ede1d2ee27a4ace86a525ecc333bf7f8b5c580afb
2019-03-29 17:26:44 +00:00