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

10161 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
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
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
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
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
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
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
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
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
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
drh
168184da7c Fix CLI CSV test cases so that they suppress the CR on windows and thus
work cross-platform.  Test case changes only - no changes to code.

FossilOrigin-Name: 89d9120af9b5ff9d2e1ed019270a539a8334c9395ea4035ecc021d90b3ddb764
2026-06-17 14:12:07 +00:00
drh
c89700b6c0 Limit VIEW recursion depth to SQLITE_LIMIT_EXPR_DEPTH to prevent
static overflow in malicious schemas with tens of thousands of
levels of recursive views.

FossilOrigin-Name: 38430aa5ed787ab8d24cc4d7f03b5528168e12b1f59ecfce9c471cd755b81cc7
2026-06-16 13:46:54 +00:00
drh
d49588d0d9 Enhance SQLITE_LIMIT_TRIGGER_DEPTH so that it also limits a chain of
distinct triggers during code generation.

FossilOrigin-Name: b22709dcb3d967e1ad9a8c0bd0ab7335efda0933d643e734d24e8cfc79325249
2026-06-15 16:49:06 +00:00
drh
732bffada9 Fix a problem sometimes causing an UPSERT to incorrectly convert an excluded.* column from type REAL to INT in cases where doing so does not cause data loss.
FossilOrigin-Name: 5d344e02887996cded51e4b1febe7a3bb488b0f05465653cc0daac34e8ba036c
2026-06-15 16:46:14 +00:00
drh
2161a3d88b Improvements to handling of inequality constraints on generate_series().value
against very large floating-point values.

FossilOrigin-Name: e10ff7cd09e962c207f897c38b83a813a3214fd4ac11e6a71ac577f21ba09fba
2026-06-15 16:27:51 +00:00
drh
461f6c14c5 Fix rounding behavior in the decimal extension when all leading digits
are 9 and there is not fractional component.

FossilOrigin-Name: ae568e059bb179343c31baa3c8bcbe1c64fdcbb28b466af4840963c63d6369f5
2026-06-15 10:16:23 +00:00
drh
aff01bd5a4 Make the --header option to the CLI sticky, so that it does not get
turned off by subsequence --csv or similar mode change options.

FossilOrigin-Name: 50193066013df50af113576ae0b59af447212472da6d3824ca5aaf7dc9aab3ec
2026-06-13 18:17:08 +00:00
drh
790e97cb4f Fix a buffer overwrite in fts3 that could occur while processing NEAR queries against corrupt records.
FossilOrigin-Name: 85afd8e291d280ff2124d1650720dd9934271de6efbd5a50eeaf1b621d3d0a6e
2026-06-12 16:04:50 +00:00
drh
2dc1c576e9 Fix a signed integer overflow that could occur in fts3 when processing corrupt database records.
FossilOrigin-Name: 42fe4d2e8bbb2ff9ebfd8a9b981bd8769f5273bba74cc1795396820f44a443cb
2026-06-12 11:45:37 +00:00
drh
d9439caee6 Fix a crash that could be caused by configuring the pager-cache with a bulk allocation too small to fit even one page.
FossilOrigin-Name: 3be41e17529d34d083463d967bcb7e07515ce0d6ba616a4a04a68f162ba0cf7f
2026-06-04 12:27:17 +00:00
drh
eaba46222c Remove the data type ANY added to the shell's CSV imports.
FossilOrigin-Name: e14e19c1b33b4f4fe7d9008b0f7f8fa9522d901c13124b0eca4b91acd7156d0d
2026-06-04 11:35:15 +00:00
drh
1ba44fc5e0 Fix problems with expressions like "(?,?,?) IN (SELECT c,b,a FROM ...)" when there is an index on columns "c", "b" and "a", but not in that order.
FossilOrigin-Name: af0bf4ee7778359d96b43605d947b44bbcef9f489732d0890103992cd970c3b5
2026-06-04 11:24:28 +00:00
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