32017 Commits

Author SHA1 Message Date
dan de739c3450 Merge latest trunk changes with this branch.
FossilOrigin-Name: c6226d508d6af28fcd42fecd482014c3e284923871d3d8f5177f728cbf3457c5
2026-05-21 15:13:17 +00:00
dan c597ed79d1 Fix a buffer overread in the session module that could occur when processing a corrupt changeset.
FossilOrigin-Name: 869a51ae84dfaaf824c872e4b3024f35eea7fa67bb584759a2d42ebf8404ef6e
2026-05-21 14:58:36 +00:00
drh f305e1921b Performance optimization to the sqlite3ExprCollSeqMatch() routine.
FossilOrigin-Name: 035f1d2f284a081e6aef01cc773a3784458ec8e6297f3fbf4063670a9e65278c
2026-05-21 14:48:43 +00:00
drh 3dbab77bf1 Remove dead code created by [20c2f8ce9242c3db].
FossilOrigin-Name: 68c5fd5fa0f986b782519472398b068ba7c295c56a0e0199b8e0509d0d1685fb
2026-05-21 14:16:47 +00:00
drh da18b56b25 Limit the length of inputs to the spellfix1_editdist() extension
function (not part of the standard SQLite build and rarely used)
to 99999 characters, to avoid any possibility of integer overflow.
[bugs:/forumpost/5da728247a|Bug 5da728247a].

FossilOrigin-Name: 51ebf0e04efcbe982e62f2228553700b8c1147a37c70fdfaa0e377184b3ac936
2026-05-21 13:37:15 +00:00
drh ecd9748590 A join constraint is not an equivalence unless both operands have the
same collation.
[bugs:/info/2026-05-21T03:39:28Z|Bug 2026-05-21T03:39:28Z].
Error goes back to version 3.7.17, 13 years ago.

FossilOrigin-Name: 20c2f8ce9242c3dbb8054f01c6c7338763c830b7c1491a99c8e1de98ce8f0a5b
2026-05-21 13:03:18 +00:00
drh 6ae9949399 Enhance the xfer-optimization to verify access to the source table using
the authorizer, if an authorizer is registered.
[bugs:/info/2026-05-21T03:31:22Z|Bug 2026-05-21T03:31:22Z].

FossilOrigin-Name: d1cdb817cafd03a4081b254a71672ba07e5b637994d3f2f925532f17af0a67dc
2026-05-21 12:04:20 +00:00
drh 37e253208f Improved entropy collection on Windows.
FossilOrigin-Name: b734b76af3f732e0db8a002781bae57aa7a01c4a7f5151605144a6aeef993a21
2026-05-20 20:03:07 +00:00
dan b869ed6b06 Fix a bug causing the session module to dereference a NULL pointer when applying a corrupt changeset.
FossilOrigin-Name: e807d4e3798efd532b3d78d1dfe513ed4fbd3cb793dd0ae5c30cae6031422b10
2026-05-20 15:06:34 +00:00
drh ccf23dadea Check-in [7cf841f3613c8302] was incomplete in that it did not remove
the incorrect assert() statement.  Fixed here.

FossilOrigin-Name: c19bacca13f699953bbf50afb867035a94080b8a48111cf3d87bced880a3e620
2026-05-20 11:53:15 +00:00
dan d3dc8e5ae5 Avoid returning an SQLITE_SCHEMA error from within sqlite3session_diff() if the schema has been recently modified. First <a href=https://sqlite.org/bugs/forumpost/269f1e9cef>reported here</a>.
FossilOrigin-Name: 20110547a117912be68d91bc006e92c45beffde16c6bcdf062bf8971c9a9a864
2026-05-20 11:41:24 +00:00
drh badc42fd74 Fix a test case added by [1249eeb1b9759038] that does not work for
the config=prepare permutation.

FossilOrigin-Name: 6aaeeffc2c7abbe32050da40bcbffc5f8d596e6df4603b8f8f23294f2465f25e
2026-05-20 01:32:30 +00:00
drh fd9eba554a Improvements to testrunner.tcl: Make C-program tests responsive to the
pattern list.  Do not remove build steps until the very end when we are
certain that the build step is not required.  The pattern list matches
the exact text of the displayname column of the jobs table.

FossilOrigin-Name: 3f409c0e1be6b71eca92eccf0b9de3ef5923a6a57be49540ebe190fc6a6d06d4
2026-05-20 00:16:20 +00:00
dan 8154476ff8 Fix a potential buffer overread in fts5 that could occur when handling corrupt records.
FossilOrigin-Name: 70021c3291b38192832c99fa4d8155249dd39f5b26334595c71f5cee66d13ebb
2026-05-19 20:27:54 +00:00
drh d258b93356 Silently ignore nested porter tokenizers in FTS5. Having nested porter
tokenizers is pointless, but it does use stack space unnecessarily.
[bugs:/forumpost/a7766198f1|Bug report a7766198f1].

FossilOrigin-Name: 0bdeedf56c9d7209d1ea8f950d0ef03c78cbf677528d9d30c5f4ec48c4e1a571
2026-05-19 19:33:49 +00:00
dan 3ef3ecdf8a Remove new unreachable code from this branch.
FossilOrigin-Name: 07f81e256fde5796c0d8bcedff8fad4368639386f40881c0844e9c86a69b6fad
2026-05-19 18:58:59 +00:00
drh 632b618063 Prevent integer overflow in the ICU extension.
[bugs:/forumpost/844bdd7d5c|Bug report 844bdd7d5c].

FossilOrigin-Name: c20cb75ca07d0553d7a847c65a40efb2e5c587579ec32b02121a8963c70db12f
2026-05-19 18:56:11 +00:00
drh d58b463ffb Fix an assertion fault that can occur in RTree given a carefully
corrupted database.
[bugs:/forumpost/2026-05-18T06:46:01Z|Bug report 2026-05-18T06:46:01Z].

FossilOrigin-Name: 7cf841f3613c8302a419638bdec83b1b9799f00cfedbfe40dca0a1a005c196b5
2026-05-19 18:45:05 +00:00
dan 1a0555610d Fix problems with error handling when applying changesets with update loops.
FossilOrigin-Name: f797925df05f1a53392dba416aa72067716bb6e38ebc679d313f8a98f89c5913
2026-05-19 18:28:03 +00:00
dan 079f8dc682 Merge trunk changes into this branch.
FossilOrigin-Name: e480e126fc1550948bd1a3635f0e3a862353dcd8b0f1921ab6e66d699110b477
2026-05-19 17:15:05 +00:00
dan 4da2ddf50e Avoid a potential 1 byte overread in sqlite3changegroup_add() when processing a corrupt changeset buffer.
FossilOrigin-Name: 4d8c3a2919dc942a0a044ec7582a688e0f93e91f4a465bb94390fbe3ad1b50b4
2026-05-19 17:12:39 +00:00
drh fdf746967c Add an sqlite3FaultSim() call to the changes at [6193e4105b6a58ea] to
make them testable.

FossilOrigin-Name: 0de3d95500b7ecd41a09d81f176c1510896e811b3e468e1cf50f752305fdb06f
2026-05-19 17:05:28 +00:00
dan c7ddaf2479 Merge latest trunk changes into this branch.
FossilOrigin-Name: 1f71b530c9e8ddce5b25ed0971447cd925f9194afc7a2f929429318a5fcb5a72
2026-05-19 16:07:22 +00:00
drh 45b4213160 Fix a incorrect assert() from [52dd437d51d3c1af] reported by OSSFuzz.
FossilOrigin-Name: 64b49e4d431d35db0920c7fc8a89d38ce2d2d2dbf42a7caf76aaa9685d66601b
2026-05-19 16:07:08 +00:00
drh cbbeddbd67 Add the "make" subcommand to testrunner.tcl
FossilOrigin-Name: 00d546812810252a4d51ff796931dc2ff5bdd5173ddb8f95fb5efccd897087ff
2026-05-19 15:13:03 +00:00
drh db5aebce43 Early detection of attempts to overwrite an in-use cache page due
to database corruption.
[https://issues.chromium.org/issues/513858286|Chromium 513858286].

FossilOrigin-Name: 6193e4105b6a58eac2bc17c5b2d55fdae332816b59beed1fe24c15dff1372322
2026-05-19 12:40:00 +00:00
drh 4d3f3c7070 Security enhancements to the untested and unused fossildelta.c extension.
Bug reports [bugs:/forumpost/3ac3fe3d71|3ac3fe3d71] and
[bugs:/forumpost/e7e470b760|e7e470b760].

FossilOrigin-Name: 2d3fbbe421d3b0ad8fa08255fd30af7f2d947919ebb90fa9c9c4ee72ffd880b4
2026-05-19 11:15:33 +00:00
drh bc94e5dbb6 Limit the size of input strings to the (disused) spellfix extension
to avoid excessive runtime and integer overflows.
[bugs:/forumpost/24a33e5d10|Bugs report 24a33e5d10].

FossilOrigin-Name: 4b16b80cf2e26c41f0828d65883145dc81c0987110c3f04a864cec43e7c418e5
2026-05-19 10:30:13 +00:00
drh d0fd0cc2fa Fix a NULL pointer dereference in the obscure (and unused) prefixes
extension, which I had forgotten even existed.
[bugs:/forumpost/24a33e5d10|Bug report 24a33e5d10].

FossilOrigin-Name: 4880adc053b0f21633936347fd5610e4338b15da39607d8ba5a6b32d1516e8cb
2026-05-18 23:58:14 +00:00
drh 1192d6f5b1 Fix an off-by-one error in matchinfo('b') for FTS3 when there are a large
number of columns.
[bugs:/forumpost/42d5f799d1|Bug report 42d5f799d1].

FossilOrigin-Name: c0f2cd6d292bb3554539a309a2ecfa0a12f0248cfcbb5594391607b107a62cd2
2026-05-18 21:45:06 +00:00
drh a20f63e0ef Limit the NEAR span in FTS3 to 1 billion, to avoid integer overflow.
[bugs:/forumpost/4cfcf164d2|Bug report 4cfcf164d2].

FossilOrigin-Name: adcb44f9dcfd34df4cf4f5cc418ecac9f2ca09723442379dfedcba532c45de77
2026-05-18 20:43:15 +00:00
dan a497743e24 Fix a problem applying changesets that contain multiple UPDATE constraint loops.
FossilOrigin-Name: 8e89aafab1b8fa7d59ac98c39b7f1c1cc23a98ba868a5dac83dee63688786a3f
2026-05-18 20:34:56 +00:00
drh a2d992a000 Prevent integer overflow due to database corruption in.
fts3auxNextMethod().
[bugs:/forumpost/bce19272cf|Bug report bce19272cf].

FossilOrigin-Name: d903795e3bdf91607f23dace5a15a070139b32e34aed8540a6c2e19c39e997be
2026-05-18 20:27:57 +00:00
drh 62cd986418 When a subquery is an argument to an SQLITE_SUBTYPE function, then set
the EP_SubtArg flag on the result-set expressions of that subquery.
[bugs:/forumpost/8de44412fd|Bug report 8de44412fd].

FossilOrigin-Name: d75c08c8416bde3f510a135ea07cc217ba6183eacda6ba895bccbf57efe9284f
2026-05-18 19:44:04 +00:00
dan 4dd11e33e4 Update the session module so that it can apply changesets containing two or more UPDATE changes that form a dependency loop - so that no single UPDATE can be applied independently without violating a constraint.
FossilOrigin-Name: 5f8010599fb33fbe1dadc894a679056a5d38040ab4f09772cd59827941e9348b
2026-05-18 18:59:06 +00:00
drh de94ec87fc Fix the window-function variant of the json_group_object() function so
that it correctly handles NULL entries.
[bugs:/forumpost/0de87b23b3|Bug report 0de87b23b3].

FossilOrigin-Name: ac3a958b0ab7766544bb406aa990668d2235ab26fb68c75ded3f71273d97b18c
2026-05-18 17:55:40 +00:00
drh e087d0f266 Do not attempt the OR-optimization on conjuncts that contain COLLATE
operators because (1) such cases are rare and (2) they are tricky to
get right and are thus prone to bugs and hard to test.
[bugs:/forumpost/329521b269|Bugs report 329521b269] is one
such bug that goes back about 20 years and thus demonstrates both
points of the previous sentence.

FossilOrigin-Name: 622882529558b4779dfb7246bd5a9de776555c8f940bb941397fb56fb9f97e43
2026-05-18 14:28:53 +00:00
drh b6ea7f0550 Fix a harmless compiler warning caused by [460243ee4c28873d].
FossilOrigin-Name: e076ac7b648988b48b546e19b5ef2e50061b44c85bc2645362409e295e3b4b11
2026-05-18 11:44:09 +00:00
drh e4ba14bc40 Correction to the bugfix at [212c68249cc0e890] so that it works
for 2nd and subsequent terms of a row value.
[bugs:/forumpost/ba8084256b|Bugs report ba8084256b].

FossilOrigin-Name: 49a3c6ade45ea31187ac8dbba0452fcad487e76f2219bfa6435feab545b5f632
2026-05-18 11:35:44 +00:00
drh b969f8c2f1 Raise an error in the dbpage virtual table if the page number on an insert
is too large. [bugs:/forumpost/f363b34881|Bug report f363b34881].

FossilOrigin-Name: 2bbc8f1404e3cbaa8fe24e2ea2d774daf2bf3b232fbd8978a1a37e4f8f0f629d
2026-05-18 10:19:14 +00:00
stephan c1bf93ecb6 Add a reference to the new sqlite.org/bugs forum.
FossilOrigin-Name: f2fe7e7a184e482411ddf792a1964e6ce30a28185da9fa79488d097382c352fd
2026-05-18 10:00:35 +00:00
drh fd88eed8fa Fix the ".prompt" command so that it honors -bail.
FossilOrigin-Name: 5b58bdd33f0410624523fc8adc230db4e5f57283d234a5f0d26a2790629bc0f9
2026-05-17 19:21:30 +00:00
drh f77a5af2b3 Fix the new %J and %j formats so they work correctly with a zero precision.
FossilOrigin-Name: 428b924dd6e228c879338c5c5edbe68bdc4d8d8e80c37e3d070a8a34b57300c1
2026-05-17 17:50:32 +00:00
drh 6df919b723 Fix the sqlite3_value_numeric_type() interface so that it works even if
the argument is an sqlite3_value object that came from sqlite3_value_dup().
[forum:/forumpost/15c4a323bb|Forum post 15c4a323bb].

FossilOrigin-Name: 460243ee4c28873d5c484a91af7ec18d03d0e726b8bb4e1e680b588e5f371400
2026-05-17 17:18:12 +00:00
drh cb388ec9a3 In the CLI, make the NO_COLOR prompt the same as the default prompt, only
without any color.

FossilOrigin-Name: cc05e9749c14d6ff4e396ad387c42d53b696680ce74ce6a92f6fb71ed9a53ae5
2026-05-17 16:35:36 +00:00
drh 0e30396fe2 When two tables are joined by USING, the affinity and collating sequence of
the join column will be the same as one or the other of the columns in the
two tables (which are hopefully the same).

FossilOrigin-Name: cbb6f72c10b1224088b9d604a0e014e7020e8d79a317ebb4af420ba3b72f40cc
2026-05-16 20:21:55 +00:00
drh fc12461f5c When two tables are joined by USING, the affinity of the join column can
be the affinity of the corresponding column in either table.  But it must
be one or the other.

FossilOrigin-Name: 8cc0b52cca2d6b155b4b169e6f9de9e7d2dc61c40f89920c2b6bf86e549ab6f7
2026-05-16 19:40:55 +00:00
drh 3cfe5c3dad Fix false-negatives in the sqlite3ExprCanReturnSubtype() routine having
to do with CASE, CAST, and COLLATE expressions and the "+" no-op operator.
[forum:/forumpost/1f0168a120:Forum post 1f0168a120].

FossilOrigin-Name: 9be94e961457967408cbd0acf11877fbb323a48eee405fff53755770f1b3261a
2026-05-16 17:28:56 +00:00
drh d3265d1473 Improved comment on sqlite3ExprCanReturnSubtype() as well as one very
minor efficiency improvement.

FossilOrigin-Name: b57d6b76b0f9f4f154997af83f14d545bf2b6b8f7194746835e4c34885db227a
2026-05-16 16:02:08 +00:00
dan 61d9f8f881 When using an index on a CASE expression that may return a value with a subtype, avoid discarding any subtype.
FossilOrigin-Name: 69c9a82cbaea7b6faa6a357dd884b1e0d2bc684d847efb31a2d64c75fabf5428
2026-05-15 19:44:24 +00:00