]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
8 hours agoAdd "end of day/month/year" modifiers to date/time functions. prev-weekday
drh [Wed, 1 Jul 2026 11:57:20 +0000 (11:57 +0000)] 
Add "end of day/month/year" modifiers to date/time functions.

FossilOrigin-Name: 2c4cb3223c6c56d05fe91b8d19b60eac26a274e41f34a2d8f2cf911927581932

17 hours agoEnhance the "weekday N" modifier for date/time functions such that if
drh [Wed, 1 Jul 2026 03:02:42 +0000 (03:02 +0000)] 
Enhance the "weekday N" modifier for date/time functions such that if
the argument is negative, it move the date backwards in time to the
matching weekday, rather than forwards.

FossilOrigin-Name: e31bea6ce188fb3ae2d8da132a40a182431d701dc6b991af470337a1cdd3f8e4

2 days agoAdd new assert()s to help static analyzers realize that the code is correct.
drh [Mon, 29 Jun 2026 15:11:58 +0000 (15:11 +0000)] 
Add new assert()s to help static analyzers realize that the code is correct.

FossilOrigin-Name: 007f0496619e571092382a3668b6bbcc17919908895dc4be71f8d1b6ec2aeeed

3 days agoMark shadow tables when registering a new virtual table that already exists
drh [Sun, 28 Jun 2026 19:05:29 +0000 (19:05 +0000)] 
Mark shadow tables when registering a new virtual table that already exists
after the schema has loaded.  Test cases in TH3.
[bugs:/info/2026-06-26T12:45:51Z|Bug 2026-06-26T12:45:51Z].

FossilOrigin-Name: 3e80958a7052a123f4599d64baa8cc31a761e5a58d04c75ca38f2a375d247808

3 days agoFix incorrect header comment on the sqlite3ShadowTableName() function.
drh [Sun, 28 Jun 2026 16:40:34 +0000 (16:40 +0000)] 
Fix incorrect header comment on the sqlite3ShadowTableName() function.
Comment chagne only. No changes to code.

FossilOrigin-Name: b5af1a5c7fc8c84e077eb3aa23fbb8712fcaf5143c228db4042f3d811fa6beaf

3 days agoCheck for oversized iTermOff in fs5SegIterNextInit() and trigger a
drh [Sun, 28 Jun 2026 00:21:50 +0000 (00:21 +0000)] 
Check for oversized iTermOff in fs5SegIterNextInit() and trigger a
corruption error if detected.
[bugs:/info/2026-06-27T18:46:54Z|Bug 2026-06-27T18:46:54Z]

FossilOrigin-Name: 130d4d10dae5957c2be50696545157cd98b6a976affa0c887ff9e1c9e17e97ab

3 days agoDo not allow an integer overflow to bypass a leaf-term bound check
drh [Sat, 27 Jun 2026 23:04:36 +0000 (23:04 +0000)] 
Do not allow an integer overflow to bypass a leaf-term bound check
in the integrity-check function of FTS5.
[bugs:/info/2026-06-27T18:47:28Z|Bug 2026-06-27T18:47:28Z]

FossilOrigin-Name: 74ba971bfafae1eba5e4f4a36e3b31f603f37cdc2010ee09ac251d6e863ac8b0

3 days agoMake sure local functions in the series.c extension have only file scope.
drh [Sat, 27 Jun 2026 21:52:55 +0000 (21:52 +0000)] 
Make sure local functions in the series.c extension have only file scope.
[forum:/info/2026-06-27T20:38:26Z|Forum 2026-06-27T20:38:26Z].

FossilOrigin-Name: d8c59f264bdb4ad927fffd9ce78a36a6754487071ff7ce3316edbd63789d7af2

3 days agoIn the amatch.c and fuzzer.c extensions (both of which are experimental,
drh [Sat, 27 Jun 2026 20:30:17 +0000 (20:30 +0000)] 
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.
[bugs:/info/2026-06-27T19:32:29Z|Bug 2026-06-27T19:32:29Z].

FossilOrigin-Name: 7bcd606c8a2746e3c9258de239e97e14c2e809b91911b1d1b49636dca8fe2d7b

3 days agoPut reasonable input limits on the (non-deliverable and obsolete)
drh [Sat, 27 Jun 2026 20:18:46 +0000 (20:18 +0000)] 
Put reasonable input limits on the (non-deliverable and obsolete)
amatch.c extension.
[bugs:/info/2026-06-27T19:15:11Z|Bug 2026-06-27T19:15:11Z]

FossilOrigin-Name: 2fe1366e649ddd964153059b3c33b380af1924afb59210ac3311fd7bc8af5922

4 days agoImproved detection of CTEs being misused as table-valued functions.
drh [Sat, 27 Jun 2026 16:07:17 +0000 (16:07 +0000)] 
Improved detection of CTEs being misused as table-valued functions.
Remove an incorrect assert() from check-in [716782abe939083b].

FossilOrigin-Name: ca197caec7b2b4fd71a9853bb2452b7ce7dd2fbb1bbc871aa375558e53c216f7

4 days agoAdd a new sqlite3FaultSim() to make it easier to test the changes
drh [Sat, 27 Jun 2026 15:25:53 +0000 (15:25 +0000)] 
Add a new sqlite3FaultSim() to make it easier to test the changes
in check-in [942498724f5bb83b].

FossilOrigin-Name: a4472a17e878fce92d88c1db08e7e390df25f6699e801602cc725cbfdb836e9e

5 days agoFix a harmless "jump or move depends on uninitialised value" warning that could occur...
dan [Fri, 26 Jun 2026 19:31:46 +0000 (19:31 +0000)] 
Fix a harmless "jump or move depends on uninitialised value" warning that could occur when using a virtual table as the RHS of an outer join within a trigger.

FossilOrigin-Name: 716782abe939083b7732289d862ddfd841057d3458814f96e5e6d7826ec7fa5c

5 days agoEnhance the documentation on sqlite3_set_authorizer() to make it clear
drh [Fri, 26 Jun 2026 15:27:30 +0000 (15:27 +0000)] 
Enhance the documentation on sqlite3_set_authorizer() to make it clear
that the authorizer callback is not invoked for elements of an expression
in a generated column.
[bugs:/info/2026-06-26T12:42:48Z|Bugs 2026-06-26T12:42:48Z].

FossilOrigin-Name: 45213c1c398cad9d05eda5420ae7379e84fa37d30793f8b4d28c358b88d62931

5 days agoFix both a buffer overread and overwrite in the sessions rebase module. Bug [bugs...
dan [Fri, 26 Jun 2026 15:04:47 +0000 (15:04 +0000)] 
Fix both a buffer overread and overwrite in the sessions rebase module. Bug [bugs:/info/2026-06-26T12:16:48Z | 2026-06-26T12:16:48Z].

FossilOrigin-Name: cc36f1741308ea354d540d27c89b92d69a0481885ca3463bdaf0b9ab27464d78

5 days agoFix parsing of unterminated "[" tokens in the incremental integrity
drh [Fri, 26 Jun 2026 14:36:05 +0000 (14:36 +0000)] 
Fix parsing of unterminated "[" tokens in the incremental integrity
check extension.
[bugs:/info/2026-06-26T10:05:53Z|Bug 2026-06-26T10:05:53Z].

FossilOrigin-Name: c8f143bd618fe59c18eb92c8f5ae1b153f03cf05e1c457910f6a46599f719809

5 days agoAvoid 32-bit integer overflow in the zipfile extension given
drh [Fri, 26 Jun 2026 14:20:32 +0000 (14:20 +0000)] 
Avoid 32-bit integer overflow in the zipfile extension given
ridiculous arguments.
[bugs:/info/2026-06-26T11:40:02Z|Bug 2026-06-26T11:40:02Z]

FossilOrigin-Name: 7eedf458ca4e8e72d309d5d342d364f49950fedca94dc157337e65d766c012c1

5 days agoFix a buffer overread that could occur in fts5 within a memcmp() when doing an integr...
dan [Fri, 26 Jun 2026 14:08:42 +0000 (14:08 +0000)] 
Fix a buffer overread that could occur in fts5 within a memcmp() when doing an integrity-check on corrupted records.

FossilOrigin-Name: 062597f10a6d3f8c959a38e4ab6ee1a885499dd7018662e3e6268b2ee6c63c1b

5 days agoFix parsing of quoted instantiation arguments in the spellfix extension.
drh [Fri, 26 Jun 2026 13:51:48 +0000 (13:51 +0000)] 
Fix parsing of quoted instantiation arguments in the spellfix extension.
[bugs:/info/2026-06-26T10:52:36Z|Bug 2026-06-26T10:52:36Z]

FossilOrigin-Name: c2e963ad948e0c244d6b883b919ec0815c20018282e04e5649c00e70f5a1d2ed

5 days agoFix unbounded whitespace skip in the decimal extension.
drh [Fri, 26 Jun 2026 13:41:07 +0000 (13:41 +0000)] 
Fix unbounded whitespace skip in the decimal extension.
[bugs:/info/2026-06-26T10:06:54Z|Bugs 2026-06-26T10:06:54Z]

FossilOrigin-Name: 71d4cfe5a34cf8485ab2e5abe670381cd068f013233d98c44355a6bcdfcbbbb0

5 days agoExtra margin to prevent queue overflow in the RTree extension.
drh [Fri, 26 Jun 2026 13:21:00 +0000 (13:21 +0000)] 
Extra margin to prevent queue overflow in the RTree extension.
[bugs:/info/2026-06-26T12:15:33Z|Bug 2026-06-26T12:15:33Z]

FossilOrigin-Name: de40bfb6b39f3252d1dc2dccc04439ac7b40c1331ded60473950cb4b96fc85f7

5 days agoFix the (non-deliverable, testing-use-only) closure extension so that it
drh [Fri, 26 Jun 2026 13:00:38 +0000 (13:00 +0000)] 
Fix the (non-deliverable, testing-use-only) closure extension so that it
parses quoted instantiation arguments correctly.
[bugs:/info/2026-06-26T10:06:27Z|Bug 2026-06-26T10:06:27Z]

FossilOrigin-Name: 11ffa3bfba77b9f3a8c4903d496f63ee26c9873f735d254f35111eecf91228be

5 days agoMark the diskused() extension SQL function as direct-only.
drh [Fri, 26 Jun 2026 12:34:22 +0000 (12:34 +0000)] 
Mark the diskused() extension SQL function as direct-only.
[bugs:/info/2026-06-26T10:52:15Z|Bug 2026-06-26T10:52:15Z]

FossilOrigin-Name: b66292820ad17b54eb5f0a48ef9ff01a1b52efd8004307c6faeeb4687ab50567

5 days agoFix the size of an allocation in fts3 to take into account that when merging a phrase...
dan [Fri, 26 Jun 2026 11:36:54 +0000 (11:36 +0000)] 
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. Bug [bugs:/info/2026-06-26T08:08:39Z | 2026-06-26T08:08:39Z].

FossilOrigin-Name: df5728d79ff09235041cf01267104f29f482af3473f5a4c849133b6048565725

5 days agoImproved detection of corrupt freelist chains on btree pages.
drh [Fri, 26 Jun 2026 09:55:59 +0000 (09:55 +0000)] 
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: 942498724f5bb83b9a7d9bbbea662d152a46a0ccaee26e4b291f090cc6e7d178

5 days agoCheck super-journal names for validity earlier, as this simplifies
drh [Thu, 25 Jun 2026 20:26:17 +0000 (20:26 +0000)] 
Check super-journal names for validity earlier, as this simplifies
verification that the logic is correct.

FossilOrigin-Name: 6ba9e19430092aef59f2a7ab6fb7bdacacbb85988f41c155a5af490b0d8a8270

6 days agoHave API functions sqlite3_serialize, sqlite3_limit, sqlite3_busy_timeout, sqlite3_er...
dan [Thu, 25 Jun 2026 17:07:53 +0000 (17:07 +0000)] 
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: 7bfd5c810c6f04ddfd275457a2a03b4da0c3e7d4ee5acb61a54d805e2e67f819

6 days agoAlso have functions sqlite3_db_name(), sqlite3_get_autocommit(), sqlite3_extended_err... db-mutex-fixes
dan [Thu, 25 Jun 2026 16:24:06 +0000 (16:24 +0000)] 
Also have functions sqlite3_db_name(), sqlite3_get_autocommit(), sqlite3_extended_errcode(), sqlite3_errcode(), sqlite3_total_changes64(), sqlite3_changese64(), sqlite3_last_insert_rowid() and sqlite3_expired() take the database mutex.

FossilOrigin-Name: 46509e48d3049a1ca52d9cc3f023634a651cd633d36bd9056ca0172759ba201e

6 days agoHave API functions sqlite3_serialize(), sqlite3_limit(), sqlite3_busy_timeout() and...
dan [Thu, 25 Jun 2026 15:47:42 +0000 (15:47 +0000)] 
Have API functions sqlite3_serialize(), sqlite3_limit(), sqlite3_busy_timeout() and sqlite3_error_offset() take the database mutex.

FossilOrigin-Name: fff2c37b9fabbbad20ace60a00e521d198a53125e371f8956275d89eb3c0f32f

6 days agoChange the undocumented and unsupported sqlite_log() SQL function so that
drh [Thu, 25 Jun 2026 15:17:15 +0000 (15:17 +0000)] 
Change the undocumented and unsupported sqlite_log() SQL function so that
it is marked as unsafe and direct-only.
[bugs:/info/3311f8d5b8|Bug 2026-06-25T10:19:43Z].

FossilOrigin-Name: c30ea3cefe346a3d87b57710a51b059371543c5abc75d08c4ca827bbe3b3f622

6 days agoImprove the sqlite3_str_vappendf() routine for additional robustness in the
drh [Thu, 25 Jun 2026 14:48:09 +0000 (14:48 +0000)] 
Improve the sqlite3_str_vappendf() routine for additional robustness in the
face of over-sized inputs.
Probable fix for [bugs:/info/2026-06-25T11:29:23Z|Bug 2026-06-25T11:29:23Z].

FossilOrigin-Name: d7e4b2a85f81dacfee497d806bbc9f8c262624bd618aa27d4d238191643a4f5d

6 days agoHave sqlite3_drop_modules() take the database mutex. Bug [bugs:/info/2026-06-25T12...
dan [Thu, 25 Jun 2026 14:25:15 +0000 (14:25 +0000)] 
Have sqlite3_drop_modules() take the database mutex. Bug [bugs:/info/2026-06-25T12:11:37Z | 2026-06-25T12:11:37Z ].

FossilOrigin-Name: 533e59b40c4ce6b3579cb85deb9cb1a7179aa2cf4f91d8848558087869653a76

6 days agoAdd test case to backup5.test to verify that detaching the destination database from...
dan [Thu, 25 Jun 2026 10:36:51 +0000 (10:36 +0000)] 
Add test case to backup5.test to verify that detaching the destination database from its handle is handled correctly.

FossilOrigin-Name: 50cce4758361379f1585b30c619f2c9f7f8873dbfaeaec3ff357e26c1034546c

6 days agoFix a harmless false-positive compiler warning on Windows.
drh [Thu, 25 Jun 2026 00:15:26 +0000 (00:15 +0000)] 
Fix a harmless false-positive compiler warning on Windows.

FossilOrigin-Name: dae75754693143603c8fc9df3f0046dec3577e17a2858e877d238dd0f46899f4

6 days agoAlternative to [15a6482300bb2804] that is testable.
drh [Thu, 25 Jun 2026 00:09:14 +0000 (00:09 +0000)] 
Alternative to [15a6482300bb2804] that is testable.

FossilOrigin-Name: 847e6a657451182be73816444c5e6f0e099dacf2cc8b99669e3b96f83dd51117

6 days agoCheck for cells extending too far past the end of a page while search
drh [Wed, 24 Jun 2026 20:20:57 +0000 (20:20 +0000)] 
Check for cells extending too far past the end of a page while search
an index.  [bugs:/info/2026-06-24T14:55:57Z|Bug 2026-06-24T14:55:57Z]

FossilOrigin-Name: 6d0696706a9e2f70229b2db52f053e540fe0a89290a6c57f23ec0c8bd7a49213

6 days agoRemove ALWAYS() and NEVER() macros used for developmemt testing on index-cell-overflow
drh [Wed, 24 Jun 2026 20:17:20 +0000 (20:17 +0000)] 
Remove ALWAYS() and NEVER() macros used for developmemt testing on
this branch.

FossilOrigin-Name: f3532fc55a2be273acb97023165e96817c291576a9d6d45f8d6e7ae57adbd577

7 days agoWhen rolling back a journal that contains a super-journal pointer, only attempt to...
dan [Wed, 24 Jun 2026 19:28:55 +0000 (19:28 +0000)] 
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. Report [bugs:/info/2026-06-24T14:18:00Z | 2026-06-24T14:18:00Z].

FossilOrigin-Name: 6d8da8861c8ccbfdbe838587dc2f5ef1817bc0af4a6167940446ee7bdc53955c

7 days agoUpdate mjournal.test so that it works on windows. del-super-filter
dan [Wed, 24 Jun 2026 19:07:30 +0000 (19:07 +0000)] 
Update mjournal.test so that it works on windows.

FossilOrigin-Name: 6007b5c2d3c27a4597631914d4114b626ba647954ecfb381de67d4cf27d31ccd

7 days agoOnly delete a super-journal if it contains a pointer to the current database's journa...
dan [Wed, 24 Jun 2026 18:51:36 +0000 (18:51 +0000)] 
Only delete a super-journal if it contains a pointer to the current database's journal. Test cases in this commit might be broken on some platforms.

FossilOrigin-Name: c768be03d4885557c9520c37e3cecbf5647d358a87cd34948578a4a0a8a59a5e

7 days agoCheck for cells that extend of the end of a page when searching indexes.
drh [Wed, 24 Jun 2026 18:50:44 +0000 (18:50 +0000)] 
Check for cells that extend of the end of a page when searching indexes.
This is a work-in-progress.
This check-in includes four NEVER() and ALWAYS() macros for which simple
test cases are needed.

FossilOrigin-Name: 27ffb3eefede00e1caa51684c82e0aefa2a86ab3d00aa23874be9afc75c2a8b4

7 days agoDo not delete super-journal files named "xyz.9hh" unless the library is built with...
dan [Wed, 24 Jun 2026 18:03:20 +0000 (18:03 +0000)] 
Do not delete super-journal files named "xyz.9hh" unless the library is built with SQLITE_ENABLE_8_3_FILENAMES.

FossilOrigin-Name: 3973e37a1ef528676de44ddb1b1f18d55b90fca1f6b43c51c3f3ba613267bb92

7 days agoWhen rolling back a journal that contains a super-journal pointer, only attempt to...
dan [Wed, 24 Jun 2026 17:14:57 +0000 (17:14 +0000)] 
When rolling back a journal that contains a super-journal pointer, only attempt to unlink the super-journal if the filename looks like one that SQLite might have generated. This is to limit the extent to which SQLite can be caused to delete arbitrary files by supplying it with a crafted hot-journal.  Bug [bugs:/info/2026-06-24T14:18:00Z | 2026-06-24T14:18:00Z].

FossilOrigin-Name: 0cdde6755837935e4feaa4367a0b107e363582adc8112a91dc7416f1100ae3aa

7 days agoAvoid trying to delete a database file while it is still open in backup5.test.
dan [Wed, 24 Jun 2026 14:17:52 +0000 (14:17 +0000)] 
Avoid trying to delete a database file while it is still open in backup5.test.

FossilOrigin-Name: 395cbed103af08e3a4fafd9a3041205535e019d4aeb58b46c4a7e4f3bca545c9

7 days agoFix a comment in os_kv.c so that it does not match "###" and thus does
drh [Wed, 24 Jun 2026 13:46:37 +0000 (13:46 +0000)] 
Fix a comment in os_kv.c so that it does not match "###" and thus does
not cause false-positives when searching the output of gcov.  No
changes to code.

FossilOrigin-Name: 5482548b6bca2827246cd2cc928c89a953365da5ebe42d3a2876371ec6880f1b

7 days agoFix the sqlite3ParseUri() for improved defenses against ridiculously long
drh [Wed, 24 Jun 2026 13:45:04 +0000 (13:45 +0000)] 
Fix the sqlite3ParseUri() for improved defenses against ridiculously long
URI inputs causing integer overflow problems.
[bugs:/info/2026-06-24T11:46:39Z|Bug 2026-06-24T11:46:39Z].

FossilOrigin-Name: 140a693ee0c0cfa8f332cd1bbdfe045c016e4bf5169d6dd94648cbe38d7517c6

7 days agoRevert the fixes to backup in [1f940357f7] and [e5db80350c] and instead fix the probl...
dan [Wed, 24 Jun 2026 13:42:39 +0000 (13:42 +0000)] 
Revert the fixes to backup in [1f940357f7] and [e5db80350c] 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. This addresses bug [bugs:/info/2026-06-24T08:41:13Z | 2026-06-24T08:41:13Z].

FossilOrigin-Name: 18da5759590793c934184a6f1e28fe61a9714f305f1e9704061364325c0bbf9e

7 days agoRemove a stray C++ style comment left in build.c by the previous commit on this branch. attach-backup-fix
dan [Wed, 24 Jun 2026 13:37:31 +0000 (13:37 +0000)] 
Remove a stray C++ style comment left in build.c by the previous commit on this branch.

FossilOrigin-Name: bfce01a4b06b5f3bfb050bf15e25919a6c85b3ec0002acd016ac8c5ffa500daf

7 days agoDefend against integer overflow on oversized string inputs to
drh [Wed, 24 Jun 2026 12:40:26 +0000 (12:40 +0000)] 
Defend against integer overflow on  oversized string inputs to
sqlite3_mprintf() and similar C-language interfaces when using
the "%!.*s" conversion.  The problem is not reachable from SQL
due to string length restrictions in SQL. C-code is required.
[bugs:/info/2026-06-24T11:57:36Z|Bug 2026-06-24T11:57:36Z].

FossilOrigin-Name: 15a6482300bb2804fbfad1f07d6d74da6c0cb5953d44b74bc61c17d29e29821c

7 days agoBack out [23936786e6] because [9725b513c0] obviates it.
stephan [Wed, 24 Jun 2026 12:23:29 +0000 (12:23 +0000)] 
Back out [23936786e6] because [9725b513c0] obviates it.

FossilOrigin-Name: ef5e415303aeeaad65987871302380e96704316daf89ab5e96330798e4cbe1ce

7 days agoUpdate documentation to explain that a odd nByte parameter to
drh [Wed, 24 Jun 2026 12:22:22 +0000 (12:22 +0000)] 
Update documentation to explain that a odd nByte parameter to
sqlite3_prepare16() is undefined behavior.  In addition, always round
down the nByte parameter to an even number so that it in fact harmless
to give it an odd nByte value.
[bugs:/info/2026-06-24T11:25:24Z|Bug 2026-06-24T11:25:24Z].

FossilOrigin-Name: 7af7c501b60358cf84e843eb147e6edf9a5aaca30b1c570abe63ca68b54e3ec2

7 days agoFixes for SQLITE_OMIT_FLOATING_POINT.
drh [Wed, 24 Jun 2026 11:51:35 +0000 (11:51 +0000)] 
Fixes for SQLITE_OMIT_FLOATING_POINT.

FossilOrigin-Name: 9725b513c0b9fe488289ac42db59af29b62ac7551f5d1de5064147ec3ca4a2fa

7 days agoRevert the fixes to backup in [1f940357f7] and [e5db80350c] and instead fix the probl...
dan [Wed, 24 Jun 2026 11:50:08 +0000 (11:50 +0000)] 
Revert the fixes to backup in [1f940357f7] and [e5db80350c] 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. This addresses bug [bugs:/info/2026-06-24T08:41:13Z | 2026-06-24T08:41:13Z].

FossilOrigin-Name: 44a0f396daa13f382fd839cd8be49148aa24114968b97fed7f365307d1f8280a

7 days agoSwap two lines to get the amalgamation building again with SQLITE_OMIT_FLOATING_POINT...
stephan [Wed, 24 Jun 2026 10:22:36 +0000 (10:22 +0000)] 
Swap two lines to get the amalgamation building again with SQLITE_OMIT_FLOATING_POINT, noting that neither the shell nor the canonical library build with that flag. Reported in [forum:8c3df4da0d|forum post 2026-06-24T07:21:05Z].

FossilOrigin-Name: 23936786e680131af644510eb50b7ad20ee39221d1fb29732dea76483aed2273

8 days agoMerge the fixes for the use-after-free problem caused by executing an ATTACH when...
dan [Tue, 23 Jun 2026 20:12:17 +0000 (20:12 +0000)] 
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: e458ed9cc9d46dfdade3b4e99eb209d8aefd40a245e002d68df1813f9f99e2d7

8 days agoFix sqlite3_backup_init() to correctly handle the case where opening the temp databas...
dan [Tue, 23 Jun 2026 19:46:48 +0000 (19:46 +0000)] 
Fix sqlite3_backup_init() to correctly handle the case where opening the temp database fails.

FossilOrigin-Name: c08bb97f399447be767ca2932858d88db5c1ba6ba29a68b1def23957206f9883

8 days agoFix an OOB read on the unused spellfix1 extension. The OOB read is
drh [Tue, 23 Jun 2026 19:28:14 +0000 (19:28 +0000)] 
Fix an OOB read on the unused spellfix1 extension.  The OOB read is
one byte prior to the start of an allocation, which is almost always
harmless.  [bugs:/info/2026-06-23T18:48:40Z|Bug 2026-06-23T18:48:40Z].

FossilOrigin-Name: e58d5efc7b3387566661475e1a9afb6b94388a835cfb178999603135d57280fa

8 days agoAvoid a use-after-free problem that could occur if ATTACH statements are executed...
dan [Tue, 23 Jun 2026 19:14:44 +0000 (19:14 +0000)] 
Avoid a use-after-free problem that could occur if ATTACH statements are executed while a backup operation is active. Bug [bugs:/info/2026-06-23T15:46:48Z | 2026-06-23T15:46:48Z].

FossilOrigin-Name: 9454592878b5732d37d61f4541bd6f0c1f893c20fc833ce4c600f9470e62d6f2

8 days agoDo not allow internal-use-only functions to be coded, anywhere, unless
drh [Tue, 23 Jun 2026 19:08:18 +0000 (19:08 +0000)] 
Do not allow internal-use-only functions to be coded, anywhere, unless
inside of a nested parse (which is the case for ALTER TABLE) or if
the appropriate test-control is activated.
[bugs:/info/2026-06-23T15:49:27Z|Bug 2026-06-23T15:49:27Z].

FossilOrigin-Name: a145307e4d0b621c5493cecc7c826e8422cbd8dbc8cd9a042b8ec9e05d389eb6

8 days agoFix a typo in a comment. No code changes.
drh [Tue, 23 Jun 2026 15:35:29 +0000 (15:35 +0000)] 
Fix a typo in a comment.  No code changes.

FossilOrigin-Name: 8a535a36a90cf12b783469289a882d1313038d444b4a7f04e3495ae9bdec416d

8 days agoMakefile doc tweaks. No functional changes.
stephan [Tue, 23 Jun 2026 14:11:16 +0000 (14:11 +0000)] 
Makefile doc tweaks. No functional changes.

FossilOrigin-Name: d85204bbd92f362c5c7d744d59f7be6923cdbf1f15f7220e70af4090161c24c2

8 days agoImprove robustness against corrupt kvvfs journal files. Addresses bug report [bugs...
stephan [Tue, 23 Jun 2026 13:26:35 +0000 (13:26 +0000)] 
Improve robustness against corrupt kvvfs journal files. Addresses bug report [bugs:f4d88886e6|2026-06-23T06:51:34Z] and the first follow-up report in that thread.

FossilOrigin-Name: bd24ea4d76c8d6816ac5177593ee3427b71b0508b5cdc804c29b2ed25405b9c8

8 days agoFix a NULL pointer dereference that could occur in the unionvtab virtual table if...
dan [Tue, 23 Jun 2026 11:14:45 +0000 (11:14 +0000)] 
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. Bug [bugs:/info/2026-06-23T05:32:49Z | 2026-06-23T05:32:49Z].

FossilOrigin-Name: 3a2163f9693086bc494ac899647f09467b1aba905f4db147910f203aaab724f0

8 days agoFix a NULL pointer dereference that can occur when misusing a extension
drh [Tue, 23 Jun 2026 11:09:55 +0000 (11:09 +0000)] 
Fix a NULL pointer dereference that can occur when misusing a extension
virtual table that was created for testing purposes.
[bugs:/info/2026-06-23T05:32:49Z|Bug 2026-06-23T05:32:49Z]

FossilOrigin-Name: 256d5cd478b83b1371ce24c9702f732cddb4dd4e06c238fc1a1b853b02ffc1f1

8 days agoFix an OOB read in the next_char() function of the
drh [Tue, 23 Jun 2026 10:51:24 +0000 (10:51 +0000)] 
Fix an OOB read in the next_char() function of the
"spellfix" extension.  The spellfix extension is not a deliverable.
[bugs:/info/2026-06-23T05:41:00Z|Bug 2026-06-23T05:41:00Z]

FossilOrigin-Name: 6ede22e13f8e85c1a341c9a80a3be2f2677baee897c659af4ca43a04698e29a5

8 days agoFix dequoting error on the instantiation parameters of the
drh [Tue, 23 Jun 2026 10:23:08 +0000 (10:23 +0000)] 
Fix dequoting error on the instantiation parameters of the
non-deliverable extension virtual table "fuzzer.
[bugs:/info/2026-06-23T05:51:36Z|Bug 2026-06-23T05:51:36Z].

FossilOrigin-Name: 410045796b4486fc2d301e661bf9fce3ca3a1ba61c72fe5d6c5d59a330443dd5

8 days agoFix rounding behavior for all-9s decimals in the decimal extension.
drh [Tue, 23 Jun 2026 10:07:50 +0000 (10:07 +0000)] 
Fix rounding behavior for all-9s decimals in the decimal extension.
[bugs:/info/2026-06-23T05:07:48Z|Bug 2026-06-23T05:07:48Z]

FossilOrigin-Name: 21b2692c8363f2c0629beef4860400a1d27f499a3f27745c23391bcfa09da898

9 days agoAdd the BTREE_HINT_TABLECURSOR cursor-hint. This is not currently used by stock SQLite.
dan [Mon, 22 Jun 2026 11:02:28 +0000 (11:02 +0000)] 
Add the BTREE_HINT_TABLECURSOR cursor-hint. This is not currently used by stock SQLite.

FossilOrigin-Name: 35b3ff4007fc1abd36233a6b3b75bb6a123edc062f36437247c3dfe779868b70

10 days agoCorrect test from [96a48a15760a] - that journal was indeed corrupt, but not in the...
stephan [Sun, 21 Jun 2026 11:38:05 +0000 (11:38 +0000)] 
Correct test from [96a48a15760a] - that journal was indeed corrupt, but not in the intended manner. Add a verification that the bad journal gets replaced after a write.

FossilOrigin-Name: c9171221160f241b450d425f41bb53b42362dccfad4c3fdf64dd5c3562ed4096

10 days agoExtend the test from the previous check-in a bit.
stephan [Sun, 21 Jun 2026 11:10:17 +0000 (11:10 +0000)] 
Extend the test from the previous check-in a bit.

FossilOrigin-Name: bd6bbd0e84226c90d864c28ac4d6acd908c4f06bfe63dcfd6fa6b8d17105b338

10 days agoAdd a JS test demonstrating that [7c4db1cd2d06] recovers gracefully from journal...
stephan [Sun, 21 Jun 2026 10:55:09 +0000 (10:55 +0000)] 
Add a JS test demonstrating that [7c4db1cd2d06] recovers gracefully from journal corruption.

FossilOrigin-Name: 96a48a15760a2eee2642926874e9dfd4082518c6669f930fcc367ffd16669f39

10 days agoFix a result value semantics bug which broke application of a journal in kvvfs. Fix...
stephan [Sun, 21 Jun 2026 08:38:07 +0000 (08:38 +0000)] 
Fix a result value semantics bug which broke application of a journal in kvvfs. Fix a memory-reset bug in hypothetical non-WASM builds of kvvfs. Bug report [bugs:7fcd3ea30fa4fcfc|2026-06-20T18:22:59Z], and this resolves the journaling issue mentioned in the parent post.

FossilOrigin-Name: 7c4db1cd2d06d9dc6c4b5eed5c4fc0fc5466128a169a5d4ba261e0cb17020ae1

10 days agoFix a potential integer overflow when decoding a corrupt kvvfs block. Bug report...
stephan [Sun, 21 Jun 2026 08:13:22 +0000 (08:13 +0000)] 
Fix a potential integer overflow when decoding a corrupt kvvfs block. Bug report [bugs:76acc88b57|2026-06-20T18:35:54Z].

FossilOrigin-Name: c36fc5df62c7eb8fca6a43cb0b3154a030b39a4cfade8fb04496120d4d339b97

10 days agoFix an incorrect assert() in check-in [984c9b181801c1de]
drh [Sat, 20 Jun 2026 21:54:18 +0000 (21:54 +0000)] 
Fix an incorrect assert() in check-in [984c9b181801c1de]

FossilOrigin-Name: 1d41c93b3636de63cc4b9ee49f73319429944f2255ab56d7556595f56434c17c

11 days agoCorrect misuse of a loop control variable in writing of a kvvfs journal. Bug report...
stephan [Sat, 20 Jun 2026 11:07:04 +0000 (11:07 +0000)] 
Correct misuse of a loop control variable in writing of a kvvfs journal. Bug report [bugs:20e208fe17|2026-06-20T08:49:41Z]. Remove a snippet of dead code in the JS kvvfs side.

FossilOrigin-Name: a396d7c54c5f251daaaac1e68321c2a54d3b6969599027c29b7ca7abe7fb8c4e

11 days agoAdd the sqlite3_result_str() interface and use it to simplify the code.
drh [Fri, 19 Jun 2026 23:53:29 +0000 (23:53 +0000)] 
Add the sqlite3_result_str() interface and use it to simplify the code.

FossilOrigin-Name: 8f8361edf82233d6cd53bf8cd2f7fbf0cb3552228c9202395ef1e3383ed559ff

11 days agoUse SQLITE_FINISH in a few places in the core, to help ensure that path is sqlite3-result-str
drh [Fri, 19 Jun 2026 22:57:44 +0000 (22:57 +0000)] 
Use SQLITE_FINISH in a few places in the core, to help ensure that path is
well tested.

FossilOrigin-Name: 7356bf3a813bcd9082a7fdef5e2cc38c7a0f142f0ef4c948f78e4dafa216c039

11 days agoPut the sqlite3OomStr singleton in "const" space to ensure that it is
drh [Fri, 19 Jun 2026 22:17:09 +0000 (22:17 +0000)] 
Put the sqlite3OomStr singleton in "const" space to ensure that it is
never modified.  Doing so identified a long-standing bug.

FossilOrigin-Name: 2fe53e6d68c3f9f1c4b064fa40fe8efe12025179a973182f0bb256acb9b5d58d

11 days agoAdditional changes based on Claude analysis.
drh [Fri, 19 Jun 2026 21:43:04 +0000 (21:43 +0000)] 
Additional changes based on Claude analysis.

FossilOrigin-Name: d4691a0db1e96b646d3094f183b1fc330411a2d2472b09f9b5fe0fb268b5ca09

12 days agoFurther refinements and uses for sqlite3_result_str().
drh [Fri, 19 Jun 2026 20:01:47 +0000 (20:01 +0000)] 
Further refinements and uses for sqlite3_result_str().

FossilOrigin-Name: 974253a6058a7120354261b2134ed4803373031996957c7334161370b80bf428

12 days agoPrototype implementation for a new sqlite3_result_str() API.
drh [Fri, 19 Jun 2026 17:03:21 +0000 (17:03 +0000)] 
Prototype implementation for a new sqlite3_result_str() API.

FossilOrigin-Name: cdbc62c36a37ad687589917c6f1e92ded6d99959c54eb8d79eaaef6fa57dacd3

12 days agoFix the format() SQL function so that it returns an empty string not a
drh [Fri, 19 Jun 2026 16:55:08 +0000 (16:55 +0000)] 
Fix the format() SQL function so that it returns an empty string not a
NULL if the first argument is an empty string.
[bugs:/info/2026-06-19T16:40:04Z|Bug 2026-06-19T16:40:04Z]

FossilOrigin-Name: ece7af98a8bf982567b489cf82a52519f46a1c9360c82a486dbe1cd0664b1555

12 days agoFix a cast in fts3_write so that it is applied as intended. Bug [bugs:/info/2026...
dan [Fri, 19 Jun 2026 11:46:05 +0000 (11:46 +0000)] 
Fix a cast in fts3_write so that it is applied as intended. Bug [bugs:/info/2026-06-19T07:56:23Z | 2026-06-19T07:56:23Z].

FossilOrigin-Name: d6a3272e5592bcfeecf8a06dd8330cce57ff6603b24994b533d1fdcd48b5dc66

12 days agoFix an fts5 problem causing attempts to create locale=1 tables with more than 115...
dan [Fri, 19 Jun 2026 11:14:16 +0000 (11:14 +0000)] 
Fix an fts5 problem causing attempts to create locale=1 tables with more than 115 columns to fail. Bug [bugs:/info/2026-06-19T05:19:08Z | 2026-06-19T05:19:08Z].

FossilOrigin-Name: 979229f720e63d0294be14dae3f9fad68f76e4126a0ad63e32573cdfecd0151e

13 days agoFix a memory size computation error on 32-bit platforms caused by
drh [Thu, 18 Jun 2026 17:09:20 +0000 (17:09 +0000)] 
Fix a memory size computation error on 32-bit platforms caused by
check-in [9a2a230464e43140].

FossilOrigin-Name: dc4763b14c421710f2a19c19c1cac455c1d0244b27303b6f328c778ac188bb02

2 weeks agoSmall parsing performance improvement by reducing the amount of the
drh [Wed, 17 Jun 2026 20:11:26 +0000 (20:11 +0000)] 
Small parsing performance improvement by reducing the amount of the
Parse object that needs to be initialized.

FossilOrigin-Name: 0901b7c2dfb87707fa159f24ada5abb0a2914043c6f0571de4ce55c80edb663b

2 weeks agoRemove the unnecessary Parse.szOpAlloc field, for small size reduction
drh [Wed, 17 Jun 2026 19:28:17 +0000 (19:28 +0000)] 
Remove the unnecessary Parse.szOpAlloc field, for small size reduction
and performance improvement.

FossilOrigin-Name: 9a2a230464e4314033e67e602dbd9f554f50ec2eefc7b1a5f05b85249591f7b8

2 weeks agoSmall performance boost in the sqlite3VdbeResolveLabel() routine of the
drh [Wed, 17 Jun 2026 18:39:05 +0000 (18:39 +0000)] 
Small performance boost in the sqlite3VdbeResolveLabel() routine of the
code generator.

FossilOrigin-Name: f786f3643e410e862568777ea021afa47c924348e511a83e7e9000cf14bec534

2 weeks agoSafer conversion from double to 64-bit integer in two places.
drh [Wed, 17 Jun 2026 16:57:19 +0000 (16:57 +0000)] 
Safer conversion from double to 64-bit integer in two places.

FossilOrigin-Name: 17c444382979b70cdca78e51418366e802b2d41d1156774e5e9693b52542b84c

2 weeks agoAdditional refinements to the large floating-point handling in
drh [Wed, 17 Jun 2026 14:53:14 +0000 (14:53 +0000)] 
Additional refinements to the large floating-point handling in
generate_series().  Follow-up to [5aab8c2cde63f9db].

FossilOrigin-Name: 4247c5d9afb162a3e9f334b5121f0df2bfddb916054fa1e6fadb65b1983a7ed8

2 weeks agoFix CLI CSV test cases so that they suppress the CR on windows and thus
drh [Wed, 17 Jun 2026 13:52:55 +0000 (13:52 +0000)] 
Fix CLI CSV test cases so that they suppress the CR on windows and thus
work cross-platform.

FossilOrigin-Name: 7a2c96405e365dd2efb3593e0973536d1f87f7183d5442f3bc98ca23310e5530

2 weeks agoFix the OR-to-IN optimization so that it works in cases where there are
drh [Wed, 17 Jun 2026 13:31:01 +0000 (13:31 +0000)] 
Fix the OR-to-IN optimization so that it works in cases where there are
conflicting collation sequences on the equality constraints within the OR.
[bugs:/info/2026-06-17T05:04:48Z|Bug 2026-06-17T05:04:48Z].

FossilOrigin-Name: 984c9b181801c1de06782335eb049f32d1dc1d5739a7fb9c94630c22159a4f8c

2 weeks agoTypo fix in a comment used to generate documentation. No changes to code.
drh [Tue, 16 Jun 2026 23:59:58 +0000 (23:59 +0000)] 
Typo fix in a comment used to generate documentation.  No changes to code.
[forum:/info/2026-06-16T23:18:50Z|Forum 2026-06-16T23:18:50Z].

FossilOrigin-Name: 7386faef618acb006086d688fcea854a7c555ac1bcfcaa294ea86e964e4ce75f

2 weeks agoAfter opening a non-covering index cursor, pass the corresponding table cursor to... cursor-hint-tblcsr
dan [Tue, 16 Jun 2026 18:06:46 +0000 (18:06 +0000)] 
After opening a non-covering index cursor, pass the corresponding table cursor to the implementation via sqlite3BtreeCursorHint().

FossilOrigin-Name: d48c6d2dcd50128f35bba8931371e708d24b63f2ea7a5988af8864d18ef5d14e

2 weeks agoLimit VIEW recursion depth to SQLITE_LIMIT_EXPR_DEPTH to prevent
drh [Tue, 16 Jun 2026 13:43:08 +0000 (13:43 +0000)] 
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.
[bugs:/info/2026-06-16T04:21:51Z|Bug 2026-06-16T04:21:51Z]

FossilOrigin-Name: 3f3fb9b638f59ad982beafb7c117f24ddd3da612e62c862510805fa672ffae06

2 weeks agoFix instances of potential buffer overflow caused by loading the contents of a stat4...
dan [Tue, 16 Jun 2026 11:53:19 +0000 (11:53 +0000)] 
Fix instances of potential buffer overflow caused by loading the contents of a stat4 table with an absurd number of samples in a 32-bit build. Bug [bugs:/info/2026-06-16T11:30:52Z | 2026-06-16T11:30:52Z].

FossilOrigin-Name: 0b72246732fecd7909add28f2d95f1727e1c4dc6c8f3b8e6e3482f6d17c92d34

2 weeks agoFix a possible call to memcpy() with a NULL source pointer when the size
drh [Tue, 16 Jun 2026 09:53:23 +0000 (09:53 +0000)] 
Fix a possible call to memcpy() with a NULL source pointer when the size
parameter is zero (which is technically undefined behavior but in practice
is completely harmless) in the sha1_query() extension function.
[bugs:/info/2026-06-16T07:42:23Z|Bug 2026-06-16T07:42:23Z].

FossilOrigin-Name: 2063926473adaf9619ca10fd47b273ef59b1f77136836d575e5db3cfd68987da

2 weeks agoConsistent error messages for excess trigger nesting.
drh [Mon, 15 Jun 2026 17:39:46 +0000 (17:39 +0000)] 
Consistent error messages for excess trigger nesting.

FossilOrigin-Name: 4fb9f2ffb4b45d81c70f561f45cf29a0d5872a612b948882c4a2a14629bcbe28

2 weeks agoSpeed up SQL aggregate functions percentile() and median() by using quickselect to...
dan [Mon, 15 Jun 2026 17:27:05 +0000 (17:27 +0000)] 
Speed up SQL aggregate functions percentile() and median() by using quickselect to find the required values instead of fully sorting the array of values with quicksort.

FossilOrigin-Name: 0796d337f6a0ef02a460a24eadda20e33e8fb9ec64b696ae1addee69c1bfddeb

2 weeks agoNew Windows makefile targets for common EXEs that omit the ".exe" suffix, so
drh [Mon, 15 Jun 2026 17:14:12 +0000 (17:14 +0000)] 
New Windows makefile targets for common EXEs that omit the ".exe" suffix, so
that when muscle memory kicks in and we type "make sqlite3" on windows, it
still works.

FossilOrigin-Name: 1152463a66b47eed27b71e87533e8361b6077dc54ff55b8cd2ccde5cfa8199bd