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

31765 Commits

Author SHA1 Message Date
drh
fcd0834ca7 Fix to the interaction between indexes-on-expressions, subtypes, and
the unary "+" operator.

FossilOrigin-Name: 5d7c6fe1e93bec72c5afdf404b5ddd548595488fd420a0e8593487635228fd76
2026-07-24 14:05:22 +00:00
dan
80fd9ec141 Ensure that a hot journal is rolled back in the case where a process or system crash resulted in a corrupt super-journal record where the magic and length values are correct but the super-journal name and checksum fields are both zeroed. Frorum post [forum:/info/2026-07-20T18:27:00Z | 2026-07-20T18:27:00Z].
FossilOrigin-Name: bf70dadc2d455844cfd3e759cc2f78bd38841f7362dde302af3dce0d20303935
2026-07-20 20:15:08 +00:00
drh
e9dd890d9c Add the SQLITE_SHELL_EDITION compile-time option, which if set to a
date number of the form YYYYMMDD will try to configure the defaults
to be similar to the latest release at or prior to that date.

FossilOrigin-Name: 1d84dc151bada74952819b5193a3d39706ef54b6a1b2d52aea04666b7904210f
2026-07-17 00:27:13 +00:00
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
842b51fc1d Safer conversion from double to 64-bit integer in two places.
FossilOrigin-Name: a210f6f9391ec5a7c360a4784e0dc21937c9ccb2891eb6018cabe7932db5e4a0
2026-07-14 10:31:13 +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
ace7cf321b In the sqlite3_rsync utility program, fix three defects identified
by Anthropic.

FossilOrigin-Name: b6ab126399a5df66f0f9f4acea470afe8b8b42a28cc679f42e36bd77c1ac3d77
2026-07-09 17:13:12 +00:00
drh
4825267c06 Fix an incorrect free() call in the CLI on Windows when using the -A
command-line option.

FossilOrigin-Name: 74a4c3b666c9a8a23f22f4c5a7e039f08adac2bde45fec0349983c262631a19e
2026-07-08 20:33:08 +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
2cf7691506 Fix another buffer overread in RBU that could occur when processing an RBU database with corrupt rbu_control fields.
FossilOrigin-Name: dd482ecec3256349799fd0c8515c133539552845aef7134a82388c748bec59b0
2026-07-06 16:52:58 +00:00
drh
3e02bd230c Fix mulutiple problems in RBU and reduce divergence between the Fossil
native implementation of delta and the variant of that code used by RBU.

FossilOrigin-Name: 6870e39ecc3425db7b80432ca4cf5b9f75615f58140192557d18ed6f432f46cd
2026-07-06 16:46:25 +00:00
drh
a3542dccaa Avoid a (harmless) 1-byte OOB read due to malformed inputs in the
normalize.c extension.

FossilOrigin-Name: a6cdeee6e63e3635373d7ecfdefb99b2d607290b4e419dcd37e7eed3e73a5a2c
2026-07-06 13:57:07 +00:00
drh
88c6a2e7bc Return an error if a patchset is passed to sqlite3rebaser_configure().
And avoid a buffer overread in the session module when an UPDATE change
is rebased against a baseline that records fewer columns than the UPDATE.

FossilOrigin-Name: 37c90c8fc2d694dabc7c8e7fd49ae2ab46f91f9b88fd7c829b72225881598495
2026-07-06 13:41:48 +00:00
drh
bd57e2ebb2 Properly handle errors from the readlink() system call in the
fileio.c extension.

FossilOrigin-Name: b6500b6bf167fdbef1e25322c15d8cf54ff11bc47b869af3ed4a8fc8e45e9e5c
2026-07-05 19:24:50 +00:00
drh
fe580a88ec Fix the parse_create_index() SQL function created by the incremental
integrity_check extension so that it works for widely correct CREATE INDEX
statements.
Also fix the extension so that it removes the parse_create_index() function.
Add the sqlite3_intck_register() API function so that the
parse_create_index() function can be more easily tested.

FossilOrigin-Name: 88bfcc736144c8b2c8c2c1797a091f03d95da5dcce8a17112c3d724dc1d02813
2026-07-05 19:18:45 +00:00
drh
4ac070dd77 The jsonSkipLabel() routine, part of json_each() and json_next(), should
never return an index outside of the range of bytes of the input JSONB.

FossilOrigin-Name: 4ccbd6042af59899c843aa652445675b76931cc880002d34be8d22d597955602
2026-07-04 12:16:31 +00:00
drh
ade5e04510 Fix possible one-byte OOB read in the fossildelta.c extension.
FossilOrigin-Name: 3d6c32fc0797d97196cc16f66aa00890b5c03e241a5632a0ab27cc46c33a19a3
2026-07-04 09:28:12 +00:00
drh
c8074bb0d7 Fix possible 1-byte OOB read when decoding a malformed FLOAT5 element
in JSONB.

FossilOrigin-Name: a43c78f9f6a4a83b9bffd519a1a5634086653c8ac94ead9752fef690a4e20e5a
2026-07-04 08:52:54 +00:00
drh
78d1f78ccd Improved data validation in fts5SecureDeleteOverflow().
FossilOrigin-Name: c87fc653b0bafb23063d38c9fcd059eaeedadcb7bb920a6121665850879146c5
2026-07-03 22:59:25 +00:00
drh
dcff2fa3f7 Avoid an integer overflow in the string allocator for the snippet()
function of FTS3/4, when SQLITE_MAX_LENGTH is unusually large.

FossilOrigin-Name: 38bb8275005c3d293d1b9174450a6bb8ce2ddbca1f5d1d5e457b999f0a002d4c
2026-07-03 19:19:01 +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
1d6e8d6c2f Make sure local functions in the series.c extension have only file scope.
FossilOrigin-Name: 713f3cf69a5e49e17785a020af7448f2882059ad41468fd45d981c90e0be1db2
2026-06-27 21:57:19 +00:00
drh
00f5dc622a In the amatch.c and fuzzer.c extensions (both of which are experimental,
for testing purposes only, and are not part of any deliverable) treat
NULL inputs as empty strings.  Limit input lengths in amatch.c

FossilOrigin-Name: 3c8ba6dca0dcb64c21212685ca4234090e0c73fac3bdebc3f159ff03d0d93f3c
2026-06-27 20:35:10 +00:00
drh
9d7dbd4a2f Patch level to 4.
FossilOrigin-Name: 65214f43c82c5df99fa0ef4d13456d6293f3a96bb8ab11de8c534f9ca32985c7
2026-06-27 20:19:50 +00:00
drh
92a6c5c363 Version 3.53.3
FossilOrigin-Name: d4c0e51e4aeb96955b99185ab9cde75c339e2c29c3f3f12428d364a10d782c62
version-3.53.3
2026-06-26 20:14:12 +00:00
dan
3cc868b7c0 Have API functions sqlite3_serialize, sqlite3_limit, sqlite3_busy_timeout, sqlite3_error_offset, sqlite3_db_name, sqlite3_get_autocommit, sqlite3_errcode, sqlite3_total_changes64, sqlite3_changes64, sqlite3_last_insert_rowid and sqlite3_expired take and hold the database mutex while running.
FossilOrigin-Name: 0d57a60060ee822137f3c1cf7ba1cf40ded024d038981bd51b9cab3bf7f42b2f
2026-06-26 17:36:58 +00:00
drh
e151b6e4a1 Fix both a buffer overread and overwrite in the sessions rebase module.
FossilOrigin-Name: 12d0d2363a3082f68153393ed1aa91264ee987bc9187e7afd131d503f66e4faa
2026-06-26 15:17:08 +00:00
drh
a9fc90f932 Fix parsing of unterminated "[" tokens in the incremental integrity
check extension.

FossilOrigin-Name: 6a55dc85b73ef98f0ef31d7b0740bfe46ebb25653f2dff4eb34074d1b455925a
2026-06-26 14:47:07 +00:00
drh
948ff608ca Avoid 32-bit integer overflow in the zipfile extension given
ridiculous arguments.

FossilOrigin-Name: 2e1fdfbcc91da03795d6bb27980a329dc710d5c4c8540aa6e77413e29210be0e
2026-06-26 14:22:53 +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
7317e00f90 Fix parsing of quoted instantiation arguments in the spellfix extension.
FossilOrigin-Name: c4af6acfb0d04b418ad089ee619317a631a2dff5c7d45a88f704dbcb006f98d8
2026-06-26 13:55:52 +00:00
drh
842e4e5f20 Fix unbounded whitespace skip in the decimal extension.
FossilOrigin-Name: 9a1729a4840e8640770d557657742355f2723f2dda05efeaaf6641af730c34b8
2026-06-26 13:52:02 +00:00
drh
0c7f44361f Extra margin to prevent queue overflow in the RTree extension.
FossilOrigin-Name: 27f80408b8a499f50959e21fb1c039c6e430257ac7ceb11f5c3600b120b64258
2026-06-26 13:36:18 +00:00
drh
549b467f48 Fix the (non-deliverable, testing-use-only) closure extension so that it
parses quoted instantiation arguments correctly.

FossilOrigin-Name: edfe25b68a37bde4ae535285a11b24f721fbd76d9af8ee264d62c170f45bf52c
2026-06-26 13:07:11 +00:00
drh
081c9ebeb4 Fix the size of an allocation in fts3 to take into account that when merging a phrase doclist, each entry may grow by up to 1 byte if the rhs position of the merged lists is stored.
FossilOrigin-Name: bbaad09b3d090ba24c2069424d94897ebdef7c5fed13db9383d9cb363e3aa91a
2026-06-26 12:59:28 +00:00
drh
1ead879172 Improved detection of corrupt freelist chains on btree pages.
Plus, add assert()s to verify that the min-heap does not overflow
inside of PRAGMA integrity_check.

FossilOrigin-Name: 1a888ea60be20a80e85a108a74dab0dd9faf72ca89389defeeb9c99ecafb3ea4
2026-06-26 10:02:37 +00:00
drh
36d1b6d6ab Fix compiler warnings.
FossilOrigin-Name: 512d9449451c883a68a543f5ab8372b31324baf6216de7f71f7fc7589f2e1aab
2026-06-26 02:03:54 +00:00
dan
e4db8c5280 Have sqlite3_drop_modules() take the database mutex.
FossilOrigin-Name: 7927329d25caab7f607c8857bc6b6fc56a9ba99fbd15087076a7983b2369b4eb
2026-06-25 14:47:46 +00:00
drh
77af28550f Check for cells extending too far past the end of a page while search
an index.

FossilOrigin-Name: 6826c17021eb1af5ed4266fc26486532d0fd4fb1494a582a4ff84fb59ecec254
2026-06-24 20:31:41 +00:00
drh
a2d0dcb1a0 When rolling back a journal that contains a super-journal pointer, only attempt to unlink the super-journal if (a) the filename looks like one that SQLite might have generated, and (b) the super-journal contains the name of the journal being rolled back. This is to limit the extent to which SQLite can be caused to delete arbitrary files by supplying it with a crafted hot-journal.
FossilOrigin-Name: 9471fa2c9ce03713b875b3350d65b5ed6e38e501585126bb3b90694800edfb25
2026-06-24 20:28:31 +00:00
drh
160a2c26d2 Fix the sqlite3ParseUri() for improved defenses against ridiculously long
URI inputs causing integer overflow problems.

FossilOrigin-Name: a9cea5b555eed4315e426ee8168029840cacb165d1fcd5e2d21a105db84dc46e
2026-06-24 15:16:53 +00:00
dan
81beeb9855 Revert the recent fixes to backup code and instead fix the problem reported by forum post [forum:15d82885e2 | 15d82885e2] (that a call to sqlite3_deserialize() after sqlite3_backup_init() but before the first call to sqlite3_backup_step() on the destination db of a backup could cause a crash) by deferring caching the pointer to the destination Btree until after it is locked.
FossilOrigin-Name: d9177ed965d1284c1c8d2c6fbb8db0dd89a42909ff0a3c23e2e761a6be419011
2026-06-24 14:27:21 +00:00
dan
b9e0f62c3a Merge the fixes for the use-after-free problem caused by executing an ATTACH when a backup operation was active, and for the OOB read in the unused spellfix1 extension.
FossilOrigin-Name: 121a749d0f3d54eef7f35d527f0eed9a2531ac741452ed85d4c49556df8955ea
2026-06-23 20:28:51 +00:00
drh
486d424ed8 Do not use shared locks on SHM files when the filename is a long DOS-device
path.  Only used shared locks for UNC paths.  Do not confuse the
long-DOS-device syntax with UNC paths.
[https://bugzilla.mozilla.org/show_bug.cgi?id=2016438|Bugzilla 2016438].

FossilOrigin-Name: 246f46614fbdbc2609ee1c6fffe446abd6c0121c3e626a1776bf7e09759bc973
2026-06-23 15:16:15 +00:00
drh
a43ebd6ecf Fix a NULL pointer dereference that could occur in the unionvtab virtual table if the configuration SQL returned an SQL NULL value in place of a table name.
FossilOrigin-Name: 7e8de3ba28224a293fd1c220c3bf7ac5f721a01125debc5dce39f16745c43c17
2026-06-23 13:26:15 +00:00
drh
703395c39e Fix a NULL pointer dereference that can occur when misusing a extension
virtual table that was created for testing purposes.

FossilOrigin-Name: ee4f5d82a3347863f2eb544c780d3efcc00bb43d7ea2495aaf21099f73cf800f
2026-06-23 11:16:22 +00:00
drh
4f53fb28cd Fixes for three separate AI-discovered bugs in non-deliverable extensions.
FossilOrigin-Name: c980094956a348423469015952455a97df3ca08709338aa03ea8bbb418e8af24
2026-06-23 10:56:26 +00:00
stephan
06ca05fdfd Fixes for kvvfs journaling. Bug reports [bugs:20e208fe172cae4f|2026-06-20T08:49:41Z] and [bugs:76acc88b573e3a16|2026-06-20T18:35:54Z].
FossilOrigin-Name: 4c773f5d64246c7c47a569218215787ba2104bc2966c4bbd8907b936e396f6ea
2026-06-22 10:38:03 +00:00
drh
d5b7e82ccd Fix a cast in fts3_write so that it is applied as intended.
FossilOrigin-Name: 6c22c34e9a7bc7bb68680de87a73667f21d14bf201990040423afc426c23a4af
2026-06-19 12:14:55 +00:00