1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00
Commit Graph

1012 Commits

Author SHA1 Message Date
drh
ee5d76c56d Update some test cases in fts5corrupt3.test and fts5corruptB.test to account for recent updates to database and record corruption detection.
FossilOrigin-Name: a508bb8f88e79742df314e51e6404c964547f811d9361233157cd7a748ddfadb
2026-07-14 14:30:36 +00:00
drh
6b5272d8a7 Ensure that the "leaf-size" field of an fts5 record is only read from records that are actually leaves and are large enough to contain it.
FossilOrigin-Name: 7bad71288c6547964c36215938c1d16dd38d973ef8586f1a33814e83ee5a28f5
2026-07-09 21:10:01 +00:00
drh
c0c8251568 Fix an OOB read caused by passing an out-of-range phrase number to fts5 auxiliary API xPhraseFirstColumn() in detail=columns mode.
FossilOrigin-Name: 9aac477d65a948b3f32922899b7efbdba72faa48ac9a53cb356feafecffa9c8d
2026-07-06 16:55:39 +00:00
drh
78d1f78ccd Improved data validation in fts5SecureDeleteOverflow().
FossilOrigin-Name: c87fc653b0bafb23063d38c9fcd059eaeedadcb7bb920a6121665850879146c5
2026-07-03 22:59:25 +00:00
drh
258595adb3 Check for oversized iTermOff in fs5SegIterNextInit() and trigger a
corruption error if detected.

FossilOrigin-Name: 833d058ee396a9578316b4ef2e13214cbd265999a78d7f08b5c7e515abb32881
2026-06-28 00:24:37 +00:00
drh
450db5fbb4 Do not allow an integer overflow to bypass a leaf-term bound check
in the integrity-check function of FTS5.

FossilOrigin-Name: f45d03b1c52ae102eb92b4de21d6a5265831cfd47e51e3193b38d60744c2e0cf
2026-06-27 23:09:49 +00:00
drh
a7751a871b Fix a buffer overread that could occur in fts5 within a memcmp() when doing an integrity-check on corrupted records.
FossilOrigin-Name: f73adcfc87803f373b7c55ec280e3bcae4b9f3a1f3edc2ee21bf12c696a46be4
2026-06-26 14:11:19 +00:00
drh
36d1b6d6ab Fix compiler warnings.
FossilOrigin-Name: 512d9449451c883a68a543f5ab8372b31324baf6216de7f71f7fc7589f2e1aab
2026-06-26 02:03:54 +00:00
drh
b2de7df934 Fix an fts5 problem causing attempts to create locale=1 tables with more than 115 columns to fail.
FossilOrigin-Name: 4d993e8f5ffe4d34d4b1c579f9d50b60be6a3c6738e1c06d298e43b1222f7a66
2026-06-19 11:18:51 +00:00
drh
051745a6c3 Avoid a possible buffer overrun in 32-bit builds of fts5 that could occur when processing corrupt records.
FossilOrigin-Name: 3a4667ce36a1548fffff8bbf946d84d6bbd21e7abb216d1f37717de74ce7e2a7
2026-06-15 13:53:44 +00:00
drh
633e08da82 Fix a problem that could cause fts5 to return incorrect answers when performing prefix queries on tokens with synonyms.
FossilOrigin-Name: 4f21004f9b5fc9766183a3c4ac44cfeb6cd3e5583fef9176a26fecc2910f8c08
2026-06-15 11:52:31 +00:00
drh
a89c9f34d8 Fix a signed-integer overflow in fts5 that might occur when dealing with strategicly corrupted records.
FossilOrigin-Name: a36fc58e55c100f0c26e4426100c15287dc5613e06d5d1fb43845e3c7cda09df
2026-06-11 23:28:49 +00:00
drh
78a50f9e74 Fix four obscure yet separate problems in FTS5.
FossilOrigin-Name: a6eb055c35f091a8e864c1de3387d389e2bd3025c32596c0b7a78ebdf091898b
2026-06-08 19:23:56 +00:00
drh
6c1aa834f6 Fix another buffer overread in fts5 that could occur when processing
corrupt records.

FossilOrigin-Name: 8427cac76455ecbef224ceaccbb37b79338015bcfe67209ae462f36ffefa8466
2026-06-03 15:02:29 +00:00
drh
e7d405200a Fix another potential buffer overrun that could occur in fts5 when
processing corrupt records.

FossilOrigin-Name: e583a723fa501d0c53ad124b571bcd6a42d76daba1ea983d3a547763c2c94c22
2026-06-03 14:24:19 +00:00
drh
48aa50931a Fix a potential buffer overwrite that could occur when in fts5 when handling corrupt records.
FossilOrigin-Name: 02733fc4bc27df64b50ca5027ac94fc643146efb24bb4fdbcc70c45e1c58c919
2026-05-25 17:23:58 +00:00
drh
f034bd10f0 Fix a potential buffer overread in fts5 that could occur when handling
corrupt records.  Improved detection of corrupt fts5 records.

FossilOrigin-Name: fad98805b7d73abf0cf17919397ac50757a2b888354fcf42b72640a12f32926c
2026-05-20 10:01:25 +00:00
drh
0d8e4e27b7 Silently ignore nested porter tokenizers in FTS5. Having nested porter
tokenizers is pointless, but it does use stack space unnecessarily.

FossilOrigin-Name: 8207ca671e1253135e5e36cd123fdcfb4d1f0fcf939d2c94238425fafd38c75a
2026-05-20 09:36:42 +00:00
drh
e0b995b2a6 Fix potential buffer overwrite that could occur in fts5 when processing corrupt records.
FossilOrigin-Name: 061febcf41ca4872a0f407951e1507209daca7895122b909a7806c60b6e200c4
2026-05-11 12:00:19 +00:00
dan
0cb7603d4c Update fts5 scan costs to take into account that a prefix query combined with a rowid equality constraint is still quite expensive.
FossilOrigin-Name: 539769b63e4044018be2993894b1962df6a6ae58636682b7fb7a2dd5aaf4075c
2026-03-19 17:56:10 +00:00
drh
f6c8adf3a2 Omit explain_i calls from TCL test scripts.
FossilOrigin-Name: 204f25c882832058c3291d4d6a0a6ac2711c081cb91b19feb2cf94a25ed61ecf
2026-03-02 16:40:16 +00:00
drh
f270460366 Use only 64-bit memory allocation in FTS5. Fix for UAF reported by
Zijie Zhao.

FossilOrigin-Name: e8976d5041c929675772039b7a8fc4ff0b609537d86f9aa6e445ecd512a10673
2026-03-02 11:41:48 +00:00
drh
619f1f7083 Fix harmless compiler warnings in FTS5.
FossilOrigin-Name: 29d9132a768e0460e22e41abb8b6188181ba0fc6c4665161d3d0af28d7583e19
2026-01-25 11:56:25 +00:00
dan
4b9def1903 Fix further problems with deleting from corrupt fts5 databases in secure-delete mode.
FossilOrigin-Name: f8f89d2e10f06b54acf58a3b0543aef749c3d2b65670d4cc71530dea7997651e
2026-01-16 20:04:04 +00:00
dan
90942efd21 Fix an error in new test script fts5corrupt9.test.
FossilOrigin-Name: a5918835e172fd4eda6511d297b61368952d617eac33950b67368671e3bd40fe
2026-01-15 17:17:00 +00:00
dan
ce83fd80ad Fix a buffer overrun that could occur when deleting rows in secure-delete mode from a strategically corrupted fts5 database.
FossilOrigin-Name: 1e66d6e3276cc6aab4d002a1df13b044e61f3946322bf97cac06d98dbb68e433
2026-01-15 16:09:35 +00:00
dan
01f2907d48 Fix the change on this branch so that it works with amalgamation builds.
FossilOrigin-Name: 7f0b9e7a8bba1b73ef16257e72a055ea84fb10eb5cf0e6431fca81b2f040c5ee
2025-12-30 11:33:30 +00:00
dan
6e92494955 Avoid signed integer overflow when an fts5 'merge' command is passed -2147483648 as a parameter.
FossilOrigin-Name: 4c5d18d7f5bdcf95efdf96062c7434d5d10584a1fdfd65b18d331b8aae42e26a
2025-12-30 11:19:27 +00:00
dan
b4f6c09e60 In fts5, avoid holding an open blob handle after an INSERT/UPDATE/DELETE statement, as this can interfere with sqlite3_interrupt(). Forum post [forum:/forumpost/95413eb410 | 95413eb410].
FossilOrigin-Name: f88e1d03573f394fc7caf60704c96152717b3fe8be4eef0caeb64737054f0fd2
2025-12-09 13:41:01 +00:00
dan
8fa43479b3 Fix a problem in the xFilter() method of the fts5_vocab virtual table causing it to omit some result rows in some cases where a virtual cursor is used more than once by SQLite.
FossilOrigin-Name: 6c99e81e6c49c078f1b00952774a7007c60dc1b4ba8a8fc11357efe9c9233212
2025-11-28 11:52:40 +00:00
dan
d2c7e6925c Fix a buffer overread in fts5 that might occur while processing a corrupt db.
FossilOrigin-Name: 8b0cbc18be3c6f2501b102757af6be98c48044a296104cca7bce822ac2304515
2025-11-26 13:58:53 +00:00
dan
264bcad69a Avoid integer overflows (a) when dealing with zeroblob(N) calls when 2*N is larger than 2^31, and (b) in fts5 when a corrupt record is close to 2^31 bytes in size. Both of these require special builds with SQLITE_MAX_LENGTH set to a non-default value.
FossilOrigin-Name: 27927519696dcb78ff72e245158ea6d33a1b2c3d4da314d4d0283c47d847c3da
2025-10-13 16:07:28 +00:00
dan
eeb2e03b7b Back out [8bf26c956e]. It is not required following [8e7da8cf50].
FossilOrigin-Name: ea29180797aa4bb25180432e75a372277a6f6e2262906a9e765a3bddf8ca79d7
2025-10-10 16:04:19 +00:00
drh
80f0fcd31d Fix harmless compiler warnings.
FossilOrigin-Name: 4966d7a1ce42af8b1c50fdd40e651e80d0eeb8cb62dd882950cab275f98aba88
2025-10-10 14:31:46 +00:00
dan
40d299ae32 Avoid corrupting the fts5 index if a value that was inserted via sqlite3_bind_blob() in a non-utf8 db is deleted.
FossilOrigin-Name: 8bf26c956e199762d55c159392c2e3813a9e12b914d3ca33000bf332cd946cb0
2025-10-09 14:50:27 +00:00
drh
5b15123fba Strengthen the fts5_locale() function against integer overflow attacks,
even when SQLite is compiled with oversize values for
SQLITE_MAX_LENGTH.

FossilOrigin-Name: f0dbd9d22f558dd002e2132381de3c82d55a670399b3e527b5962b025141676a
2025-09-30 10:11:44 +00:00
drh
1ecc36a2b0 Fix a harmless compiler warning in FTS5.
FossilOrigin-Name: 89f8d02075a7b265b1f0226a0f878903e1dce27ff1ac2e8a2d62d450b9b4ec76
2025-09-24 19:51:07 +00:00
drh
f5dc671a57 Fix a harmless compiler warning.
FossilOrigin-Name: 42c225a2ed7fc95f9b01467c64ba2bf97bca216fdcd6ab1ba3fb49c068650de9
2025-09-19 01:17:44 +00:00
dan
0247e15f69 Updates to where.c to handle vtabs in joins more similarly to regular tables.
FossilOrigin-Name: 991383262b0d07ebc79fdb6bed448013cea3a0ac13292d5397dce012b1e6a673
2025-09-13 19:23:12 +00:00
dan
a6c95406c1 Avoid depending on HAVE_STDINT_H and SQLITE_PTRSIZE and other things in non-amalgamation builds of fts5.
FossilOrigin-Name: 309fdd496673bf58984fb16aef3d4cc2ad8c9f6dad7687509f4d708fed5ba41b
2025-08-14 19:36:59 +00:00
stephan
d38777134b Move the flexarray union members from [527bbc1676a85a9] to the end of their respective objects.
FossilOrigin-Name: 3082e07926695863bd5ef51c3c4803fbe267dc0d9b6ac9a717c225459f8988ba
2025-07-30 21:34:47 +00:00
stephan
df23b518da Apply alignment-related patches suggested in [forum:41cd226375cd49c6 | forum post 41cd226375].
FossilOrigin-Name: 527bbc1676a85a927352cd10a292afe041a72692ec0b1360e5a1ccaa19a32fcb
2025-07-30 19:48:12 +00:00
dan
81e9bbf8da Avoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses attached to left joins from being evaluated too early. Fix for [forum:/forumpost/428ef7c468 | forum post 428ef7c468].
FossilOrigin-Name: 9f184f8dfa5ef6d57e10376adc30e0060ceda07d283c23dfdfe3dbdd6608f839
2025-07-15 19:00:01 +00:00
dan
192d0ff8cc Optimize allocation of large tombstone arrays in fts5.
FossilOrigin-Name: 0fcc3cbdfa21adf97aed01fa76991cccf9380e2755b0182a9e2c94e3c8fb38d7
2025-07-15 14:06:15 +00:00
dan
bcfe38b96a Avoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses attached to left joins from being evaluated too early. Possible fix for [forum:/forumpost/428ef7c468 | forum post 428ef7c468].
FossilOrigin-Name: 18ba07c152294a96d510a7851a0860f982ff1e0725afeebed9a343f550f6925a
2025-07-12 18:14:41 +00:00
dan
9b91aac83b Fix a problem with the fix in [5cb8e342e1].
FossilOrigin-Name: 043ff54fb746c54bc6cfa6aa8c8a32c876c09d36163125916ad01024b98d447b
2025-07-08 19:02:26 +00:00
dan
acd1d93497 Fix another problem with running fts5 integrity-check in SQLITE_DEBUG builds, this one causing an assert() failure.
FossilOrigin-Name: 5cb8e342e1d33a0fd04fd022900eeada46a2ee23f15c6abca1b37633e77429d6
2025-07-08 18:44:56 +00:00
dan
9615cf93c8 If SQLITE_DEBUG is defined, fts5 does extra checks as part of integrity-check. Ensure that errors from these extra checks are only reported if the other, normal, tests all pass. This fixes a test case in fts5corrupt3.test that was failing if SQLITE_DEBUG was defined.
FossilOrigin-Name: 98a53fb276fa1fa733da2dd3255c35ce9f6af9b9feef6e76fb577b6d142167a2
2025-07-08 14:54:20 +00:00
drh
925b79039c Fix test case results in FTS5 that were changed error message improvements
in [48044a6b57c0a16c] but which were omitted from that check-in.

FossilOrigin-Name: e1f8e0240b14f1338e947634e840af785e5042a09cd365975e922a13a562f4cd
2025-07-08 12:37:25 +00:00
drh
e33ea17d24 Fix harmless compiler warnings.
FossilOrigin-Name: 13af4acebe09b047756c22b800136cffaba532e7fcaa448a4edf4fedb94e9bbc
2025-07-04 12:25:24 +00:00