Commit Graph

313 Commits

Author SHA1 Message Date
drh
a6ca90c38c Attempt to fix a harmless compiler warning in FTS5.
FossilOrigin-Name: 8e619c21e2326be1538b60908e7cd211558ec840835c6eb69e768eb190e1fd0b
2022-01-01 19:55:29 +00:00
dan
c436b3056d Fix an OOB read that could occur in fts5 when processing corrupt records.
FossilOrigin-Name: bb9b1a15f7e80483162049dfd981d059dc69d03348b521f7ac164a8cd3ae3cc4
2021-12-06 18:57:02 +00:00
drh
913306a53a Improved defenses against integer overflow when computing the size of a
memory allocations.  No bugs were fixed here.  But perhaps future bugs will
be prevented.

FossilOrigin-Name: eb878c01f317f09e8ef6b1bd2ec8d6d5cd6ce0bdfe9da7fa7d92d2047cc9d9e4
2021-11-26 17:10:18 +00:00
drh
134f544ab2 Fix a harmless scan-build warning in FTS5.
FossilOrigin-Name: 0bf42bb5611dc3f672cb898b8be245fd25f7a3862c1e0734effd18d75e812f22
2021-10-16 19:50:03 +00:00
dan
33cf194218 Fix a signed integer overflow in fts5 leading to a segfault that could occur when processing corrupt records.
FossilOrigin-Name: 69a3ff0cc159cdf84a5367eaf708882ddeda4fa65c96a5b546ae4a0114f02cb7
2021-10-14 21:13:02 +00:00
drh
d7ace22d8c Fix more harmless static-analyzer warnings. As of this check-in, no warnings
are generated by scan-build for clang-6 or clang-10.

FossilOrigin-Name: a7835bead85b1b18a8affd9835240b0baf9c7af887196bbdcc3f5d58055042fc
2021-10-05 18:33:38 +00:00
drh
7a3b4451a1 Fixes for harmless static-analyzer warnings. This also makes the code easier
for humans to understand.

FossilOrigin-Name: 36177a62feeb4fa93ab6e3c6f4dbe1ddcf63bb02f93284abab979da0261b218e
2021-10-05 17:41:12 +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
dan
adfb203a7d Fix a buffer overread in fts5 that could occur when processing an "ORDER BY rowid DESC" query against corrupt database records.
FossilOrigin-Name: fe098a93340b8dac15752f1be4f681e2a591f7ae1a94b177f400ccd7ef638480
2021-10-01 15:05:19 +00:00
dan
415540ddaa Fix an out-of-bounds read in fts5 that could occur when processing corrupt records.
FossilOrigin-Name: 9bbc01fb239b4aa752a56c584baa29655a3c845425d5c17d24a3939984d54fe2
2021-09-29 13:36:58 +00:00
drh
dd31c033c6 Fix harmless compiler warnings.
FossilOrigin-Name: d678ecca02698753d1b33e072566112e94ea36d0d3a8f4a24d2b09d131968d88
2021-09-22 14:43:35 +00:00
dan
eb84c6ef35 Fix a memory leak in fts5 that could occur when writing to an fts5 table that is being scanned by an fts5vocab cursor.
FossilOrigin-Name: 1183552de10b64a776874a23be8962c0693e5e0cd1a191ea8fa5d6a02b691e4a
2021-09-07 16:05:48 +00:00
dan
fb8ca7de0c Fix a use-after-free error that could occur if an fts5 table is written while scanning it using an fts5vocab cursor.
FossilOrigin-Name: e751c2ec786b5c1a1c9640fdc3fde036879a2c32db2bd67fe7c72604780f67b8
2021-09-06 16:15:23 +00:00
dan
cc516af4cc Instead of disallowing writes to fts5 tables if there are fts5vocab cursors open on them (commit [c49a6ed7]), abort any fts5vocab queries if the on-disk structure of the fts5 table changes.
FossilOrigin-Name: 9dbdc9001e3258e71ca995fbcdebf66ab95890ded87fa7125c6cb4bd43010aaf
2021-07-07 11:51:03 +00:00
dan
8d2a9c3b3a Add defensive code to better handle corrupt records in fts5.
FossilOrigin-Name: a99c29b5efaf17e34506cda5ce017ec0112b3cb24bf8a2f1831f0c14a8aa8d30
2021-06-09 13:39:11 +00:00
drh
18f9be897d Remove two assert()s in FTS5 that checks for database corruption right before
actual code does the same check.
dbsqlfuzz 9680db8f5338cb9b6060eb3a02d984555d4472e3.

FossilOrigin-Name: f3f82967b2e9fd4168d86300138ac4bbcd6ffd7a3ff5ecf20acdc29e5356ac3b
2021-06-08 23:46:59 +00:00
dan
bc85a51595 Fix a buffer overread that could occur in fts5 when handling corrupt records.
FossilOrigin-Name: 078962a2164a784b135bacee51ef10973dc2e30de04353d48698d0e72edd63d8
2021-06-07 17:36:57 +00:00
drh
e31cba5675 Remove an assert() in FTS5 that can (rarely) be false in the event of an
OOM while processing a corrupt database file.

FossilOrigin-Name: 5f12f89154843e83b1d69ea1652e881d583aa329df732af72dd59029cd7eb577
2021-05-06 13:45:37 +00:00
dan
a4cd0bbcb3 Fix a segfault that could occur when querying a corrupt data structures with an fts5token table.
FossilOrigin-Name: cbedfa05501f3eb9750fb21e2ab8516f8f14c479c847f454e52572af278aab71
2021-04-27 11:28:57 +00:00
dan
f3d5a68461 Fix an assert() in fts5_index.c that may fail if the database records are corrupt.
FossilOrigin-Name: dfadb96edfef1d49e48a659264b9eb8d7f98d95d159d95c92c30dd4ba6c6e739
2021-04-23 11:37:01 +00:00
drh
214b50314a Fix harmless compiler warnings of unused function parameters in FTS5.
FossilOrigin-Name: 14273915979f8fbf80111e795b5511a6ee24638896b9d434d6ccf4bf7f7a7f62
2021-04-22 19:34:31 +00:00
dan
304cbc17c2 Fix an undefined signed integer overflow in fts5.
FossilOrigin-Name: e6f0adb00da84561e686a8db83858c7fd6b008756dd1aef807ea68f878ca3db7
2021-04-13 17:45:36 +00:00
dan
d73ade7d87 Fix issue with failing --enable-debug --enable-fts5 build.
FossilOrigin-Name: e7491acc0c93b7b0b5a27130d956bb23f876b90ced11cdd416a86727af076ee1
2021-04-06 17:51:18 +00:00
dan
f22c590bab Remove some test routines from release builds of fts5.
FossilOrigin-Name: 3088bf15ca53fac3bad94f241e648836631b6d801d42837c238ff27d85074ca4
2021-04-06 14:46:50 +00:00
dan
55b2e8b062 Fix further sanitizer complaints in the fts5 code.
FossilOrigin-Name: 4cb00b9d4020a51f690720c6f51009c5be8c22ef8c70807ead1d953d19784f26
2021-03-10 19:32:47 +00:00
dan
3be2b860d0 Fix a few sanitizer complaints in fts5.
FossilOrigin-Name: 4fe4fee00e9294fa384bd073ed8e9a2a4ad10dcf653b6ad4851e44a64443ede9
2021-03-10 14:57:10 +00:00
dan
8718f0b613 Fix a buffer overrun that could occur in fts5 when running a prefix query against a corrupt db.
FossilOrigin-Name: 4da40620ac8557aba6e1e06e720418b55e9950f406288b03749ef1b117041cd9
2021-03-03 19:36:40 +00:00
dan
5763f3d582 Fix a broken assert() in fts5 that could be triggered by corrupt database records.
FossilOrigin-Name: b79f59f9ad897d5bd4b9d17e6219bc765b02450bfe14dc020485f221ba6b02cb
2020-12-19 15:39:10 +00:00
drh
aeb6bc5628 Fix harmless compiler warnings associated with the recent FTS5 enhancements.
FossilOrigin-Name: 1db7c751912beb57a697ac8e85b9c29e30da7b6c89207e9828bf08e56c58242f
2020-12-04 17:05:16 +00:00
dan
3190b88e75 When merging prefix lists in fts5, use 16-way merges instead of 2-way merges. This faster.
FossilOrigin-Name: 026a93508ec392ca5cd2578ae9eab64974f58beccda088e10d4cc951f237632f
2020-12-03 21:22:37 +00:00
dan
64f1ef6abd Allow a search for an N character prefix in fts5 to use a prefix index of size N+1, if no prefix index of size N exists.
FossilOrigin-Name: 78a7801d8fc9e58a62e5168e35b52b7440340549123fc6a537e2abd571f6fe7b
2020-12-02 19:08:15 +00:00
dan
0fa433b40c Improve performance for fts5 column filters that filter for more than one column. e.g. "{col1 col2 col3}:phrase".
FossilOrigin-Name: d8de2f236d43a88fac7550a0451951dd5a945eb304e32f82e662479cea7c2684
2020-12-02 16:23:05 +00:00
dan
1c5b23f170 Fix a case in the FTS5 integrity check where a corrupt database could cause a buffer overread.
FossilOrigin-Name: a32b4f650d2d543bd2773cbc8655c1679a20b35ac9ec4d08c7754ddf6d972acb
2020-11-27 15:28:26 +00:00
dan
f6b0464e36 Fix some fts5 problems with signed integer overflow causing segfaults in -ftrapv builds.
FossilOrigin-Name: 7e17c2f4b7dc9b563d0b4da949bb134dc7c4fc9c86ce03891432a884ca6409d5
2020-10-12 18:09:16 +00:00
dan
7548ab20e6 In fts5 integrity checks, do not compare the contents of the index against an external content table unless specifically requested.
FossilOrigin-Name: 782163693f37aeb65209bebbaeb6659a36881b8c4b4bec778b366658488bf966
2020-09-21 14:53:21 +00:00
dan
3acd3fb9d8 Fix a "jump depends on unitialized value" valgrind/asan error in fts5.
FossilOrigin-Name: 66f94d623c16b4527e42f0519e32ec78eaf9ee6fd61ee7d0eb657cc59a8f7d68
2020-09-17 14:16:02 +00:00
dan
bbc9e1908a Fix an integer overflow bug in fts5 triggered by a corrupt record.
FossilOrigin-Name: 49da8bdce17ced910b414d50e8df79800513dcf03a196197dc1ea8e47deeda92
2020-07-13 11:06:30 +00:00
mistachkin
8122c6e9be Fix variable declaration issue seen with MSVC.
FossilOrigin-Name: 8a6fe3066cf0599fcf2960e8fb3ae39e4e7a61ec81e8ec71d0b5910aee2c16f6
2020-01-23 00:08:25 +00:00
dan
4fcce747e2 Fix a problem causing fts5 integrity-check failures if numeric values are inserted into a table within a utf-16 database. Fix for [752fdbf6].
FossilOrigin-Name: bae060f382e4386c0793db4aa280fe9cd4893307d17a1801a17218ae4dc031c2
2019-12-24 20:51:01 +00:00
dan
3fee9de239 Fix another case where malformed utf-8 was being mishandled in fts5. Fix for [df46a6f3].
FossilOrigin-Name: 1c0a05b09a97e6e2e9b11c31ed6ec7e6484686614b587ebfd0cfe27d973ba461
2019-12-24 16:20:05 +00:00
dan
84d17bdaa7 Fix an assert() added as part of commit [a11b393dc] that can fail if fts5 database records are corrupt.
FossilOrigin-Name: 4630c1ec013a4c2e54a34c9a64b2c803ac3912450de660497eb34ee21c91f426
2019-12-24 15:35:53 +00:00
dan
c26e78d275 Fix a spurious report of corruption that could be made by the fts5 integrity-check in SQLITE_DEBUG builds if the fts5 index contains malformed utf text.
FossilOrigin-Name: a11b393dc2c882cf0b3c47c3405bf43ca1d6459605bd39cccce4d32da653a72d
2019-12-24 14:27:03 +00:00
dan
ef2df8f343 In fts5, fix a case of overreading a buffer by 1 byte when counting characters in malformed utf-8. Fix for [dd1f67bf].
FossilOrigin-Name: 8d964e1c21d4cea699023e02b0616a75c5859dd083c9365cdcbc0676ebbdaae4
2019-10-24 20:35:27 +00:00
dan
52612bec3c Fix a resource leak in fts5 that could occur if an auxiliary function is called from within a query that does not use the full-text index.
FossilOrigin-Name: b528bdcd45db1b783ecd9739c3d3c890f04de7003f079668970eafaf8e23b2f3
2019-10-20 08:26:08 +00:00
dan
ae55737fbf Do not allow users to effectively disable fts5 crisismerge operations by setting the crisismerge threshold to higher than the maximum allowable segment b-trees on a single level. Fix for [d392017c].
FossilOrigin-Name: 86e497209217abb7bcb491a023cd353f3c7c9c103ebd9f58dd8661b12cf3694c
2019-10-09 18:36:32 +00:00
dan
fbd79cc585 Fix problems with using the fts5 'rebuild' command inside a transaction that contains other updates of the same table. Fix for [e258f008].
FossilOrigin-Name: 238e0835714696aba0631f288fcc30ec5fddb43893d469c6bf017f386b3cddee
2019-10-08 13:34:24 +00:00
dan
b186a622ee Disallow page-sizes smaller than 32 bytes in fts5. Also ensure the fts5 integrity-check works even when "PRAGMA reverse_unordered_selects" is true. Fix for [265e935b26].
FossilOrigin-Name: 8ab0aebdb3c2d6fb3160b2c58ce6cc0495a6ddd960878a6395958c837f3d1b71
2019-10-07 20:36:18 +00:00
dan
4b48c72721 Fix a "jump depends on unititialized value" valgrind error in fts5 triggered by corrupt database records.
FossilOrigin-Name: 6b6751cd90601a1e2744a7d233c973291ecb783801b9327c3b99734dd22bcd27
2019-09-18 11:46:34 +00:00
dan
50b3ea2daf Fix a potential buffer overrun in fts5 caused by corrupted database records.
FossilOrigin-Name: c465d0eb478e42045e08efe8b6fa64d4bd4d747cdf743beae4608562b014169e
2019-08-29 14:25:44 +00:00
dan
298680d15a Fix a potential buffer overrun in fts5 caused by corrupt database records.
FossilOrigin-Name: 156d612800a7282fe0ebb20feb31d3fd577f4ab60fab8c00940c87143997aefb
2019-08-24 17:11:29 +00:00