10130 Commits

Author SHA1 Message Date
drh c867ce4b89 Use tail recursion on the larger of the two partitions when doing a
quicksort as part of the implementation of the median() function,
to avoid excess stack usage on pathological inputs.

FossilOrigin-Name: b8fce837cf633af7e489e9750bcd1764e96f9ad7ea01847d5ef9c7060f01a4bf
2026-06-03 16:23:45 +00:00
drh ceb66403bb Fix an integer overflow problem in fts3 that could lead to a buffer overwrite on platforms where size_t is 32-bits.
FossilOrigin-Name: 1389ec7bf6a7f68406adae6fd532497b2496f01fb5b465e18bd683da3f8f53ad
2026-06-03 15:54:58 +00:00
drh c911dda3d3 Fix a potential UAF bug in the zipfile extension.
FossilOrigin-Name: 46fbc23c16b3d104605f5abe5d7a5e779021e264bde409f2d9939de9b5cb9b37
2026-06-03 13:16:20 +00:00
drh edec48cd40 Avoid excessive recursion and stack overflow in fts3 when processing a corrupt
database.

FossilOrigin-Name: c32ddb6a3fe2b8cd5f8a8a133bd2d4061243a3bc0e7e29a96b4d0e5e6090977f
2026-06-03 12:04:07 +00:00
drh f7915390d5 The prefix_length() function should stop at the first NUL terminator.
FossilOrigin-Name: b5f9dc646df5059e546ceb1404a62aadeff4a33163d9b3758e78a33ff3c23467
2026-06-03 11:30:01 +00:00
drh b2543d0098 Disable transitive WHERE constraints when there are explicit COLLATE
operators.

FossilOrigin-Name: 4c0455efe57d1e3c27327e942a1509de3eb7b0902bc3b90473e2cba8df90139b
2026-06-01 18:07:44 +00:00
drh 4902f35e63 For expressions of the form "(x, y...) IN (SELECT a, b ...)" where the
result is not true, consider the collation sequences of columns "a" and "b" 
when determinining if the result should be false or NULL.

FossilOrigin-Name: 5ceba3fe8d9fb2b1e44a048b6e010d427b7f464b727b58824a2af1b53d57f1ec
2026-06-01 16:38:10 +00:00
drh 2a95fade33 Fix a minor problem with test case mjournal-3.3.
FossilOrigin-Name: dc1cc4d908df0e36447d0422ecbbbb6d2f59c7b49243407f8a9602e7bb0d1a00
2026-06-01 15:47:23 +00:00
drh 193a8f3673 Do not allow the argument to a table-valued function to reference a table
to its right, even if the SELECT is inside a common table expression.

FossilOrigin-Name: 27b4f821c752a65197746952cc168fab6a3aa0039d1a0100e3d8415225b5d4bf
2026-06-01 13:48:25 +00:00
drh 81ceb00b00 Fix an integer overflow that could lead to a buffer overrun in the zipfile
extension.

FossilOrigin-Name: ae9c99b904a8d1b9745a8f09cb35412e4107f4f24f95cabccc18a777b9e76bdf
2026-06-01 13:44:19 +00:00
drh c22fe7a31c Be sure to do floating-point to text conversions in JSON to the full
17-digits.

FossilOrigin-Name: 9498dade8754909d6fadc8cdff44dafc7770d53a1984ba27a00317ecd7e2f3dd
2026-05-29 23:17:09 +00:00
drh 600eb440c2 Fix a 32-bit integer overflow in sqlite3changegroup_change_blob() that
could lead to a buffer overwrite.

FossilOrigin-Name: f2a8ae2251561f2255c2974914293647cf304c6db79de9da957755fccaf8a8b6
2026-05-26 14:23:36 +00:00
drh e9b5658888 Fix QRF so that it works sensibly with "--wrap 1"
FossilOrigin-Name: 90eb6c22687449441824c7da5741a31e78bb78098c170382b230e851d03212c0
2026-05-26 13:57:36 +00:00
drh 18bc656fe1 Fix HTML ">" quoting in QRF.
FossilOrigin-Name: f6b35a9b5fc38245414f1bea9bc3c81b57f774711e77ab32fb91c984370ed5e9
2026-05-25 23:47:05 +00:00
drh bf5c8d7d16 Fix a potential 1 byte overwrite that could occur when processing
a carefully crafted super-journal file.

FossilOrigin-Name: f654fa5ac938bb61d917fc33298052f5bd7a6e5e33b0539ac15cbd45bec023d3
2026-05-25 18:50:36 +00:00
drh 22bce652b3 A join constraint is not an equivalence unless both operands have the
same collation.

FossilOrigin-Name: 4247f48eec004c311cb046b1e97fbd44bc35d4b09e33c2b930dd3e1baabdb813
2026-05-21 13:06:04 +00:00
drh 62587d292b Limit the size of input strings to the (disused) spellfix extension
to avoid excessive runtime and integer overflows.

FossilOrigin-Name: 2a8951b548a9408df300d238a9fea313268a30c322f0efc0b233bdd3e71a7f9d
2026-05-19 10:33:53 +00:00
drh 4e2383b65b Fix a NULL pointer dereference in the obscure (and unused) prefixes
extension, which I had forgotten even existed.

FossilOrigin-Name: 24b8ecd17f70f222c40aa91382515a7d0d0b82c882498ae0714818d672806e7f
2026-05-19 10:30:29 +00:00
drh a66d74e1de Fix the window-function variant of the json_group_object() function so
that it correctly handles NULL entries.

FossilOrigin-Name: d29d9512a72972778c374524a3cd5d52a1377bf7fb7ff34028135146d75909b8
2026-05-18 17:58:30 +00:00
drh 574d888a10 Do not attempt the OR-optimization on conjuncts that contain COLLATE
operators.

FossilOrigin-Name: 4c105d79010939bdb8cb0461c3926f80815d4f0213bc0206be76015218cb8125
2026-05-18 14:32:45 +00:00
drh a523e20bba Correction to the bugfix at [212c68249cc0e890] so that it works
for 2nd and subsequent terms of a row value.

FossilOrigin-Name: 49c9b80e52642b94f1fa0b50ecd33a96b98a8c28d1175ac2c490d22e8c1433ce
2026-05-18 12:12:06 +00:00
drh 3580d166e5 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: 8096d548eb035afc94653303000cff2f63a4c996c1dd9bf6114c4299376088fc
2026-05-16 20:29:03 +00:00
drh 1e4ec59e3f Fix false-negatives in the sqlite3ExprCanReturnSubtype() routine having
to do with CASE, CAST, and COLLATE expressions and the "+" no-op operator.

FossilOrigin-Name: 8eb07e92cfecb6f369206f71b42edad81d7eced0ca5576a13fd754eb7db16e55
2026-05-16 17:34:27 +00:00
drh af24f5e21e Have window functions sum(), total() and avg() correctly handle the obscure case where integer overflow occurs as part of the same step that adds the first real value to the running total. Fix for forum post [forum:ec538b04ce | ec538b04ce].
FossilOrigin-Name: eb95d18aee8ffb9a2550aadbecccaf43c0a5778973386da1196a46f645e04286
2026-05-16 17:09:12 +00:00
drh 7678510ff2 Have the sqlite_dbpage module correctly handle constraints of the form "WHERE pgno=$pgno" when $pgno is an integer that cannot be represented as a signed, 32-bit value.
FossilOrigin-Name: b6ce57f807297966f305d257e616f1c88a2f25c29f622249194b19d6fa014580
2026-05-16 16:08:03 +00:00
drh 066b667313 Prevent internal-use-only SQL functions from being used inside of a CHECK
constraint added using ALTER TABLE ADD CONSTRAINT.

FossilOrigin-Name: 6cb565fe20049a48619fa3c7995de30fd9e284cfacd1652465e1f9083daf2669
2026-05-11 14:47:45 +00:00
drh a5ce91b319 Fix upward propagation of expression properties into row-value expressions.
FossilOrigin-Name: 5e639b7f15c1de773a83eccfeea67122616a62105299af41dd7c2df2ea74102c
2026-05-09 13:57:11 +00:00
drh 0268517163 Fix a corner-case floating-point rounding problem in the generate_series()
virtual table.

FossilOrigin-Name: 931119281252ba73693770ac301010a84eb9c2b06247b17e3252271163341ab0
2026-05-09 12:08:59 +00:00
drh 55f2cf294f When using the OR-optimization on a loop created by exists-to-join,
do the early-exit logic for the whole loop, not for each individual
OR branch.

FossilOrigin-Name: b827cdcb371d07cd4ffba4d3c7b404bece43fcc808db528b94a66bf77b6aab4f
2026-05-04 18:30:02 +00:00
drh e64e95b437 Fix a crash that could occur if sqlite3_deserialize() was used to overwrite a database with an open transaction on it. Bug introduced by [fc42d31d6fca21ab] on 2018-03-07 and first released in version 3.23.0. This is not a vulnerability as an attacker that can exploit this already has the ability to execute arbitrary code. Forum post [forum:39134ba029 | 39134ba029].
FossilOrigin-Name: b7b0745d6def6b141c900884cd97f10f3afedcbfb4bd9ce2409ee2380a8602dd
2026-04-27 12:28:23 +00:00
dan 2114d8bbd2 Update interrupt2.test to avoid using Tcl_GetCommandInfo() from within calls to Tcl_DeleteCommand().
FossilOrigin-Name: 00daafed79290b9bbf7a9359b656d8841745caf22c1c3cdcbacf05eebcfe300c
2026-04-23 11:33:26 +00:00
drh 928890f18f Various minor bug fixes cherrypicked from trunk.
FossilOrigin-Name: f1276db5dabe797dfeee2afbb9f3a3fe367b5f860a07af88963f16aa3986f7b9
2026-04-21 22:55:44 +00:00
drh 7b3ed290d3 Fix another bug in EXISTS-to-JOIN - this one
having to do with an OFFSET clause of a LIMIT.

FossilOrigin-Name: f91099ecee5413b3ab7261461e774436f5a9214101eea10d234135abe70bb444
2026-04-21 13:06:15 +00:00
dan 4c6c2ed134 Handle the case where the name of the constraint in an "ALTER TABLE DROP CONSTRAINT" command is quoted. [forum:8bfbaec404 | Forum post 8bfbaec404].
FossilOrigin-Name: 2d37af77a139cdcecb959b0821e5ed925f12789a759d0c94dce29d4b30b5750a
2026-04-15 16:22:59 +00:00
dan df3e207501 When generating make.sh for testrunner, correctly quote the value of any options passed via environment variable OPTS.
FossilOrigin-Name: 0837933b49f5fc5590f2052808bc305aceccafbf5db65aae250c594ce48d4d32
2026-04-09 06:38:31 +00:00
drh a7200804eb Fix a buffer overflow bug in a recent check-in, reported by unsolicted
email from OpenAI/Codex.

FossilOrigin-Name: be891a137af15897691250324e4d3d9c96f0c5fb414bca27d0c3bfdd3012a8a2
2026-04-08 17:00:33 +00:00
drh 7ff8b558e8 Enhance testrunner.tcl so that a PATTERN argument that begins with "~" is
an "anti-pattern".  Only run tests that match one or more patterns if there
are any patterns *and* do not match any anti-pattern.

FossilOrigin-Name: c313d91bb67b56be2db46194c3baa5a72b469595de3b2abe249612838dc175e4
2026-04-03 19:48:01 +00:00
drh fc19b2ca8a Minor patch to test/json/json-speed-check.sh. That script is not maintained,
but this fix at least gets it working for now.

FossilOrigin-Name: 9d92e371ca375776d251fe446f17a437823cc96e48a5c45f42cb0768d0a47f65
2026-04-02 16:21:47 +00:00
drh 5239e69fb1 Remove a harmless unused variable from the fp-speed-2.c benchmark.
FossilOrigin-Name: ff9008e7615d877e6cc852c60097777006b274971646d368eaa56b99a7acf6c7
2026-03-28 14:21:53 +00:00
drh 20d93e16d7 Enhancements to the fp-speed-N.c programs, suggested by Andreas Kupries.
FossilOrigin-Name: 7d81ff4c509d4039ef9e2f1066284ec560131422db0cbffa7e1826d71bb8f8e1
2026-03-28 14:17:53 +00:00
drh ff8a0895d6 Fix up the floating-point speed tests so that they only need to be run once
to get a performance comparision.  Provide the fp-speed-test makefile target
to build and run them both.

FossilOrigin-Name: 09e0e78a8265c2e2bc36fef1fa88bd5bf414f9b776966c1c91a4ed4b7866331d
2026-03-27 20:18:06 +00:00
drh a2f78f665c Add a comment to test/fptest01.sql to remind us that failures in that
script might not be the fault of SQLite.

FossilOrigin-Name: 65efcb0a2ed49fa2fd747b5f034d976ed3cb4a01a185bcada70bf8a5208f3841
2026-03-27 19:25:25 +00:00
drh c4cedd7ffe New test cases for text→float conversions.
FossilOrigin-Name: bbf2d648376a965605d5c641a889ab7ef365bc53788d984c054468e9889deee6
2026-03-27 18:58:50 +00:00
drh be2242d2ee Change the print resolution the fp-speed-1.c test to 17 digits.
FossilOrigin-Name: c687b32a956315ddf4336df42deb4037c37d51b536b8a24c5cef4c5a0bc4c79b
2026-03-27 14:54:01 +00:00
drh 2dd3b4a646 Update fp-speed-1.c and fp-speed-2.c to include its own timers, so that it
works on platforms that lack the "time" command.

FossilOrigin-Name: 9b083070de2d782fe1db62652af8f3cd48abe16b55b974f3927b738e3d914887
2026-03-27 14:19:01 +00:00
drh 4570aeb7bc Add the fp-speed-2.c performance test program.
FossilOrigin-Name: b788256f1980531e7abb15c5fbcdd40ae166f091aea28f449c0407105ddf1aa4
2026-03-27 14:03:41 +00:00
drh f163bfba4e If the argument to REINDEX is EXPRESSIONS (with no schema prefix) then it
updates both expression indexes, and any indexes named "expressions" or
all indexes of any tables name "expressions".

FossilOrigin-Name: 72650dc152279a6da1937f377b1e16b79f4cd664841e12222dc5459838408d22
2026-03-20 19:30:58 +00:00
dan bd580270a5 Ensure that collation sequences on non-PK columns of a WITHOUT ROWID table are used correctly when they are part of a row value comparison. Fix for forum post [forum:7a308e933d | 7a308e933d].
FossilOrigin-Name: 078b3162d0d3d3035f4d3ad88664066d99c218a731ac481b9f1172529e26e4eb
2026-03-20 11:35:15 +00:00
dan 58012b85b0 Do not assume that a recursive CTE emits rows in ORDER BY order. Fix for forum post [forum:deb1eadf4d677bd5 | deb1eadf4d677bd5].
FossilOrigin-Name: cadb6cdd32c3c9abd7e063f25acd39dddc9ff764a16019ffd5aa11063175326f
2026-03-19 10:51:40 +00:00
drh 5a6772eaa5 Comment improvements. Ensure that tests in shellB.test that require
virtual tables do not run when compiling without virtual table support.

FossilOrigin-Name: a270c6cc0eea8a8a2cf1ce30d724b2f12b11a1c343cd8520bd7843f4e62878f8
2026-03-18 17:16:18 +00:00