Commit Graph

630 Commits

Author SHA1 Message Date
drh
608af68ad3 Use the FTS_CORRUPT_VTAB macro rather than a direct call to
sqlite3Fts3Corrupt() in [2fad2a89527757b3] so that the build works
in all cases.

FossilOrigin-Name: 029c59cdf9e7dbb431f5d110bc69c3597458edc9b6b009b2e91422de705a19fa
2021-11-05 12:34:06 +00:00
dan
3555274419 Fix a crash that could occur in fts3 when processing a corrupt database.
FossilOrigin-Name: 2fad2a89527757b3956538a6bf91ebebe9c483f22f94e889e8b50c58f5100c5c
2021-11-04 18:04:55 +00:00
dan
fb8e71c584 Fix a case in the fts3 offsets() function where a corrupt database record could lead to dereferencing an uninitialized pointer.
FossilOrigin-Name: 7b7d31a6153b1505288eb3e849d0d9ef9e88e961c7b2f918ef5582fd77990f6d
2021-10-20 11:40:34 +00:00
dan
dee0359ddb Fix a use-after-free in fts3 that could follow an optimize() in the middle of a SELECT statement when the hash table is non-empty.
FossilOrigin-Name: 8124b2ceb71447157283b16f9a7fa6e250003b9ddf1c1b45f91db64aed79b5da
2021-10-12 11:30:07 +00:00
drh
7d4c94bc0f Fix harmless static-analyzer warnings.
FossilOrigin-Name: 32f33f356931242b59c01b5df7e180941231e3d9c91577ad33aa4a01e9d59092
2021-10-04 22:34:38 +00:00
drh
11a9ad5669 Fix harmless static analyzer warnings in sessions, rtree, fts3 and fts5.
Add the -DSQLITE_OMIT_AUXILIARY_SAFETY_CHECKS compile-time option to cause
ALWAYS() and NEVER() macros to be omitted from the build.

FossilOrigin-Name: 1c67f957fc77e37ce8f0d447c41ca975e8e79a35d332739c24a633649b5b0387
2021-10-04 18:21:14 +00:00
drh
c59ffa8c1e Fix harmless static analyzer warnings.
FossilOrigin-Name: 1ebcde72e2046dffaa408d2a5a4a5bbf35fdf4b096e0e088dcffd9360effdaa7
2021-10-04 15:08:49 +00:00
dan
822810b95a Avoid a buffer overread in fts3 that could occur when handling corrupt data structures.
FossilOrigin-Name: 45f459d2fa4be97d9bbb970efbc0b5d40efaf93f52ed111fd0fcdc572c24327b
2021-06-08 12:15:56 +00:00
dan
ec73546103 Fix a buffer overrun in fts3 that could occur when handling corrupt records and '^' queries.
FossilOrigin-Name: 9d0b6b0f42a47a3892ebc765250756fb8b844e8399d992a8b65f55af3800ea06
2021-06-07 15:28:33 +00:00
dan
4fd82a2a78 Fix an undefined-integer-overflow problem in fts3.c.
FossilOrigin-Name: a0bf931bd712037e44e8d7cac3c00a6715c1b451f222bad3184d3ecab1a4c7f4
2021-05-05 11:47:34 +00:00
dan
6c68e55689 Fix another undefined behaviour in fts3 that could follow an OOM error.
FossilOrigin-Name: fac3ff857c4abdb44f59849af80d93a5bd4b64f088e5164fb5ad0be8d14748b7
2021-04-16 17:09:58 +00:00
dan
7f2eb8fff2 Avoid signed integer overflow when finding snippets in fts3 by using 64-bit integer offsets.
FossilOrigin-Name: 4cc09a872f627f4a2b94345bef07cd49c3ec3627f8d78c1eb091741cdb4ec0b3
2021-04-16 16:55:28 +00:00
dan
11a6e9d9f0 Fix an assert() in fts3 that might fail when handing corrupt records.
FossilOrigin-Name: d0e2d6742f314f71562e404980aad20de6b17e0b04c08582c18bbc4fd0360751
2021-04-16 11:25:37 +00:00
drh
6af2a728e4 Fix an obscure memory leak in FTS3. dbsqlfuzz 26a51001beeff35649d2e328b05ec06f93c577a5
FossilOrigin-Name: be7cd9ebb1ba360c60469073b2e526cb1cceea702e43fcc07f47b47986908c8f
2021-04-08 13:41:20 +00:00
drh
e7e7481a29 In FTS3, if the xBegin method fails to start a transaction due to an OOM
error, then make sure that the virtual table is left in a consistent state.
dbsqlfuzz 85ef48423fda4eef79a551654445d8ef3537a590.

FossilOrigin-Name: dd553578333f49950a197fe894d02e08cce011c9ae1a7270604186af204dcf6d
2021-04-07 12:59:09 +00:00
dan
acbae3ba10 Add "#ifdef SQLITE_DEBUG" blocks around test variables sqlite3_fts5_may_be_corrupt and sqlite3_fts3_may_be_corrupt.
FossilOrigin-Name: 004559544e661f9afa60306c4ac6842c29a8630b3663d62aa0cdc637f176932e
2021-03-29 20:04:31 +00:00
dan
3fb7bd5ee0 Fix sanitizer complaint in fts3 code.
FossilOrigin-Name: 424b39eaeb578f85e58214af4b467e6e363431308ab7a327774e62fa70d3c2db
2021-03-10 20:04:21 +00:00
drh
4bb4293b2a Limit parenthesis nesting depth in FTS3 expressions to
SQLITE_MAX_EXPR_DEPTH.

FossilOrigin-Name: 5ddd8032ef9ecd5b53909d304c8f1375a72f270fd7810964cb4e385e25bedd4f
2021-03-06 15:13:26 +00:00
dan
fa9011ec70 Fix a crash in fts3 that could occur when running a NEAR query on a corrupt database.
FossilOrigin-Name: 609d94996324f3d3c12bb8cc04a2527d1d86c35cdb2267b5b34053c961158986
2021-03-06 13:28:07 +00:00
dan
c6920cdb0c Fix a case where fts3 was erroneously reporting corruption.
FossilOrigin-Name: e6c7683c7503ac743d1d476c60c31f887b7ad829e26e812c25acdd4366044db8
2021-03-03 16:00:26 +00:00
dan
1e0cfd7184 Fix a case where FTS3/4 could pass a NULL pointer to memcpy() when handling a corrupt db.
FossilOrigin-Name: 68bb541a39833d7d4bf41aa91cb6cd9c98757d1fc8236299d09db7e9b14d8ec9
2021-02-20 19:22:32 +00:00
dan
ec8962869a Update mkunicode.tcl to match the change erroneously made to machine generated file fts5_unicode2.c in [b7b7bde9].
FossilOrigin-Name: 326d579d777fdede6bc64f9525248767f4730de4e50260b0387e614a9d006416
2020-11-26 20:13:54 +00:00
drh
c08716a317 Fix harmless USAN warnings from gcc9.
FossilOrigin-Name: 72c4c69fea13f5e24df25645e6941ce3ff896f0a3c73cd63329f819cc907ab40
2020-08-11 21:53:42 +00:00
dan
26c48d2aab Fix a problem building fts3 separately from the amalgamation.
FossilOrigin-Name: 2a167cfbb2abd76e1b33116b671e58a767fc972dd79bee0004aad09a1dd2b487
2020-08-10 19:30:21 +00:00
drh
08b9208660 Fix harmless compiler warnings that surface in newer versions of GCC.
FossilOrigin-Name: 9d670a318381f219b467653f5f9539097808b887ae37291ce13be462dedfb18d
2020-08-10 14:18:00 +00:00
dan
9d44327a83 Fix another case where a corrupt record could cause an assert() to fail in fts3.
FossilOrigin-Name: 28515bbbae4fbc260457dea7a0f7414be1837d6db27fec5514f8da358bfc1f0c
2020-07-23 13:45:47 +00:00
dan
b16425d05a Fix a broken assert() in fts3 that could fail when handling corrupt records.
FossilOrigin-Name: 5124732370fd53c93314c9c79b4251bd46ce81c2e7aa4f59e2c1889cc4263d5a
2020-07-10 11:12:36 +00:00
dan
7db1ed50b8 Fix handling of another corrupt database case in fts3.
FossilOrigin-Name: ccff8cb8267d4c5605484f7a35c1836937f20b3d6879fe84cd84dc24bbbffc77
2020-07-09 21:29:34 +00:00
dan
f488bc1147 Avoid a potential buffer overread in fts3 when processing corrupt records.
FossilOrigin-Name: 4d0cfb1236884349168f8e2ec5e18c0232965148af78615e0d5c9b0e13a35422
2020-06-30 15:32:12 +00:00
dan
b695bab055 Fix another fts3 problem with processing corrupt records.
FossilOrigin-Name: 6e0ffa205312416830340ea6e621dfb1a529e5603d569941ed6263930dc28c45
2020-06-29 13:33:56 +00:00
dan
30b5db1261 Fix a problem that could cause an infinite loop in the fts3 'merge' command.
FossilOrigin-Name: be545f85a6ef09cc6c762f7d2ab7a0b3adf5590c3fbdc9903e6b5b5cec6e823f
2020-06-26 20:41:18 +00:00
drh
067b92ba00 Extend the refactoring into extensions. Clean up stray newlines.
FossilOrigin-Name: 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b
2020-06-19 15:24:12 +00:00
dan
0ad1b3284a Fix an assert() in fts3 that could fail when processing a corrupt record.
FossilOrigin-Name: 4adc0a1b0d84c2df6d6bf0d5d9d3fa9f7d048af8d232c4beb77518727890f212
2020-06-17 14:54:06 +00:00
dan
b65ce39607 Fix an assert() in fts3 that can fail when processing a corrupt record.
FossilOrigin-Name: a58a6d6fb241a50c4c7c9af8a9c65bc4746e905b2ae12290c7182afa944053a2
2020-06-16 14:06:20 +00:00
dan
56e38185fe Fix a buffer overread in fts3 that could occur when decoding a corrupted record.
FossilOrigin-Name: 9a4a40c45feb2bb89020dc7711b4753479112ceae7ce2a44521d72afeddfac83
2020-06-12 15:17:27 +00:00
dan
5c10930fa9 Fix a case where a corrupted fts3 record could cause an assert() failure, or spurious SQLITE_NOMEM error in builds with assert() disabled.
FossilOrigin-Name: d48af4d2cfff3d5f4ccc3db5d658e8b503255b577e6e62b5c2b4a4437875b895
2020-06-08 14:43:41 +00:00
dan
becd68ba0d Fix a use-after-free bug in the fts3 snippet() function.
FossilOrigin-Name: 0d69f76f0865f9626078bee087a22fb826407279e78cf9d5382e1c985c9f64a9
2020-05-16 17:26:58 +00:00
drh
219b8e7e75 Fix a null pointer deference that can occur on a strange matchinfo()
query.

FossilOrigin-Name: a4dd148928ea65bd4e1654dfacc3d8057d1f85b8c9939416991d50722e5a720e
2020-05-14 23:59:24 +00:00
dan
2d3ed22a3f Fix a failing assert() in fts3 triggered by a corrupt database.
FossilOrigin-Name: cb299a090c81cdc5c116c4e15ab38fce112916f8b0fad0c7f2ab127e79238a94
2020-05-07 19:55:40 +00:00
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