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

31797 Commits

Author SHA1 Message Date
drh
3538f83a21 Experimental: expressions within {...} may not contain subqueries.
FossilOrigin-Name: c7f8429ab7c19d9c88c1653d252158309e0f7393ea37c5efcf81f084e262ef07
2026-10-16 11:15:13 +00:00
dan
df7e35ba28 Handle temp triggers attached to databases clobbered by sqlite3_deserialize() in the same way as those attached to DETACHed databases.
FossilOrigin-Name: 872587e1567020e32c6c833b40818ba88a0b02de97b9db7b16daae08762508a8
2026-10-05 18:11:38 +00:00
dan
70fdddaed0 Ensure that eponymous virtual table objects are not left with dangling schema pointers if the main database is overwritten using sqlite3_serialize().
FossilOrigin-Name: 794e3e0fe386284327c3a58f7071087ab9d3580aae44efe835663597f74e39c2
2026-10-05 14:13:52 +00:00
stephan
95e64f0e68 [fa44643f65d6] inadvertently removed its circular-cleanup protection by fixing the finalizer ordering. This check-in fixes that. Spotted in [forum:ba4cb328a7|forum post 2026-09-30T14:59:13Z].
FossilOrigin-Name: fc3b85a1b75bb880195b88523f6d75f825f6874c487cd4d69254d588c9123c67
2026-09-30 15:45:23 +00:00
stephan
16acbb7207 Cherry-pick fixes [c9dd4d88e44a] and [fa44643f65d] into branch-3.53.
FossilOrigin-Name: f774529206f3cb41ff9e40133eec374c4b790c0315d1b895cb20b0893d17a4bf
2026-09-30 13:32:02 +00:00
stephan
7f13746e4c Fix the OPFS SAHPool VFS's xLock/xUnlock to properly deal with multiple handles to the same underlying file within the same JS thread. Addresses [forum:5e66a600ba6e57de|bug report 2026-09-30T10:49:15Z]. Also (unrelated but code-adjacent) make sure that the VFS releases all of its internal mappings when it's paused.
FossilOrigin-Name: 079400229e098b807143001c0e534b48e8dcec6c9171d6c10d8bec0c59254ec4
2026-09-30 11:56:05 +00:00
stephan
a614ce42e4 Correct the xCheckReserveLock() impl of the OPFS SAHPool VFS to fix a corruption case involving multiple handles in the same JS thread to the same filename when one leaves a journal behind. Addresses [forum:b2fbb61642|bug report 2026-09-29T18:25:28Z].
FossilOrigin-Name: ea1d55e202e6e6212d3d2286895ca343b820b96b50e6281ebaf1d23514684811
2026-09-30 10:37:55 +00:00
dan
c62ea0ab7d Have RBU refuse to update any table with GENERATED columns.
FossilOrigin-Name: 2a2ed4dc5a9085f213e3d3aeb0532b3898dae2e70f3f165c5c9b5c695e403dfb
2026-09-25 16:43:01 +00:00
dan
e504c9592b Fix 8 byte buffer overwrite that could occur when applying RBU updates to databases containing indexes with more than 16 columns.
FossilOrigin-Name: 15e5ba7e54d302edadcebe34b3c2bdab42635641d6b45f12dae10731982d3920
2026-09-25 15:16:37 +00:00
dan
63b6d70525 Avoid a use-after-free problem in rtree triggered by an attacker manipulating the shadow table schema to ensure sqlite3_last_insert_rowid() returns 0 after certain INSERTs. Problem reported by Claude and Ada Logics.
FossilOrigin-Name: 11ce330557c395509abf59f26c99269c4bc9117789bd37d46c9b7197038ad19e
2026-09-24 20:18:27 +00:00
stephan
1c9a10b2b4 Cherrypick JS kvvfs fixes from [ce09bfe406728312] (superfluous writes) and [c43287d8855b3f9a] (a potential buffer ovewwrite).
FossilOrigin-Name: eefb455f1d137f4cc3b76deddacb2e43310eca264befeaf9d3acda500d78290c
2026-09-23 14:15:06 +00:00
drh
6f460586ad In PRAGMA integrity_check, double the space available for checking that
every byte of a page is used only once as a safety margin to deal with
unforeseen kinds of database corruption.

FossilOrigin-Name: f28d770d87531499f11b8a5e458714af53cc6f5b3c972b37f1a021a10e4b4787
2026-09-10 20:10:58 +00:00
drh
cbe7e67d7b The value returned by json_each.root should be SQLITE_TRANSIENT, not
SQLITE_STATIC.

FossilOrigin-Name: 65a1a9138873de07df60bbd55e461b922230b645c6f5b6230233585f90208105
2026-09-10 10:25:02 +00:00
drh
325f8529f4 When generating code to evaluate a vector IN constraint where the RHS
of the IN operator is a subquery, if the removeUnindexableInClauseTerms()
subroutine changes the order of terms in the IN operator, then do not
allow the modified IN operator to reuse a previously generated evaluation
of the subquery.

FossilOrigin-Name: 2f95f4a873af70901945bf486e9ec99534994b7dd3d5639a5ab7ce9f0cd96c68
2026-08-24 14:41:51 +00:00
drh
91d0dbd25c Fix the zipvfs virtual table so that it works with UPDATE OR REPLACE.
FossilOrigin-Name: a914d28b02ae45295e570f6ef0c69c02983ee2686ff91edf57fd6e2d52fd2f41
2026-08-19 15:32:38 +00:00
drh
c3b9659a92 Detect and report FTS5 index corruption early enough to prevent CPU stack
overflow.

FossilOrigin-Name: 9e0f6a70965e6c9db57bcae272526c91c3c6e512a44394d7678ef30315466a54
2026-08-19 14:31:33 +00:00
drh
41d42bf5aa Limit the depth of recursion in the internal clearDatabasePage() routine.
Raise a database corruption error if it goes too deep.

FossilOrigin-Name: 0a0740db709632eb9a10193af3b7f49ecccda275ba8f53fc9762ecaf2cbd542d
2026-08-19 12:02:26 +00:00
drh
c47743de13 Prevent a corrupt database from causing a CPU stack overflow in PRAGMA
integrity_check.  Report the excess btree depth instead.

FossilOrigin-Name: 0670d6d6f39c1e1ce67f6d2a96155014a0595211af88f90f0008cd2d1097f535
2026-08-18 13:11:05 +00:00
drh
66dbfda34c Limit the number of nested RIGHT JOINs (or FULL JOINs) that can occur
in a single query.

FossilOrigin-Name: 81561e928514b27f2c4dd3a8b174b02b936cdd3ac73746c1066e822a5cedd278
2026-08-18 10:14:28 +00:00
drh
2cf6637c40 Limit the number of statements in a trigger to 65000.
FossilOrigin-Name: ed8d4fd91e6db4da342ac77282a15a95977e91db81f5a3fd204e6733d1eb262c
2026-08-18 09:23:44 +00:00
drh
ec1ee47f4c Declare fts5 structure records corrupt if they contain a page number greater than 0x7FFFFF00.
FossilOrigin-Name: 14be580d240496f1615dad42c5442443c0629f3aff6ba8ac77485992d5e8d625
2026-08-18 00:30:58 +00:00
drh
aa661c2e67 Avoid a problem causing a use-after-free in the fts3 snippet() function.
FossilOrigin-Name: 9a367c177f4cf7b065e0361ef848ffb2eb4956ef94084f440bc07958ef076bf5
2026-08-18 00:23:42 +00:00
drh
fe650fa6e3 Increment the patch level to 5.
FossilOrigin-Name: f7371f41f96f5b94d037c073863fe94ed8f1f7b9bb050d2d0405e162fcafa318
2026-08-17 13:02:42 +00:00
drh
ca7a4778be Avoid a buffer overrun when processing a strategically corrupted changeset.
FossilOrigin-Name: a1dd7123d87252d9ec801a31f34858fab9b8453b50a20f64bb05075b2b5f85aa
2026-08-17 12:59:08 +00:00
drh
cff880190d When reading a frame from a WAL file where the WAL pagesize and the database
pagesize disagree, be sure to fully initialize the page that is read.

FossilOrigin-Name: 4fde87b2a0f2effb0fd9fa553a955f6509f9659934c1b5bfbc7c02e96ec41487
2026-08-16 10:52:21 +00:00
dan
50563d14a4 Fix a problem in fts5 secure-delete code that could lead to a buffer overrun when dealing with a strategically corrupted database. Problem reported by YEONBA.
FossilOrigin-Name: 34171bee084f70801c1d35f6620313ed5c7684bc94060eb8f19ae3d2408024d2
2026-08-11 14:50:12 +00:00
dan
5dd4cd6b7a Fix a problem causing sessions module conflict handling to malfunction when used with a database handle configured with sqlite3_extended_result_codes(). On this branch, problem first appeared in [919d393a3b] and was released as part of 3.53.3.
FossilOrigin-Name: f1731d830038e3b86ca80e21cabb3c012d1db0956308e4cf3a7f4f1b86651453
2026-08-07 13:38:11 +00:00
drh
ec91a47924 Fix a single byte buffer overrun in the approximate_match extension.
FossilOrigin-Name: 0ae62bb4d910e4f87fa0ba39164a5d72802d11af58cf6b1a37c77085aa28cad0
2026-08-04 14:07:02 +00:00
drh
6b42d0401e In fts5, account for the possibility of negative docids when allocating
a buffer to store the results of merging detail=none prefix lists.

FossilOrigin-Name: f8c72d27b27ccb77312824a118c4dbc422dc98e954a8413d33277a6d9f6b3f53
2026-08-04 12:29:22 +00:00
stephan
4ba5a076b1 Add a test for [012550c089].
FossilOrigin-Name: 6a496de180c342b728f663d771b30fbcae487898d64e9fb4c322f26639d19510
2026-07-26 16:06:30 +00:00
stephan
8f9219d25c Fix a JS container API misuse in sqlite3.oo1.DB.close() which caused its fallback cleanup of still-open statements to not actually do so. Reported off-list by Jure Rotar.
FossilOrigin-Name: 012550c089146772ef576daf9f64db778117b62d3082c0b08130fa39370e82dd
2026-07-26 15:40:37 +00:00
drh
b09c88c140 Version 3.53.4
FossilOrigin-Name: bf7c7f30031888f4e796e429ab3978879485813aaca6f641c7b33e4e09459bcc
version-3.53.4
2026-07-24 19:02:57 +00:00
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