Roll src/third_party/sqlite/src/ 7d348fc79..727f7c899 (642 commits)

https://chromium.googlesource.com/chromium/deps/sqlite.git/+log/7d348fc79216..727f7c8991f7

$ git log 7d348fc79..727f7c899 --date=short --no-merges --format='%ad %ae %s'
2026-02-10 grt Amalgamations for release 3.51.2
2026-01-09  Version 3.51.2
2026-01-09 Dan Kennedy To ensure that the sqlite3_hard_heap_limit() call it makes is effective, add "sqlite3_config(SQLITE_CONFIG_MEMSTATUS, 1);" to fuzzcheck.c.
2026-01-09  Avoid signed integer overflow when an fts5 'merge' command is passed -2147483648 as a parameter.
2026-01-09  Fix potential OOB read on the undocumented test function rtreenode() in the RTREE extension.
2026-01-03  Fix yet another bug in the EXISTS-to-JOIN optimization.
2026-01-02  Ensure that loops created by the exists-to-join optimization use unique cursor numbers, even if the EXISTS expression in the WHERE clause is a copy of an expression from the result-set of the SELECT.
2025-12-31  Use 64-bit integers to track memory allocation sizes in the CSV extension.
2025-12-31  Update the autoconf tarball Makefile.msc to align with the canonical makefile.
2025-12-31  Use sqlite3_malloc64() in all places in the compress.c extension to avoid integer overflow.
2025-12-31  Fix a typo in check-in 0819fe670f9ceec7 that lead to incomplete protection against buffer overflow in the zipfile extension.
2025-12-19  Fix a memory leak in the fileio extension on windows.  Other changes to makefiles and similar to get zipfile testing working on Windows.
2025-12-15 Dan Kennedy Enhance the unixIsSharingShmNode() code (check-in [6385a1962c69c69c]) to avoid possible deadlocks with threads in findResuableFd().
2025-12-09  Fix an incorrect answer that might arise if a scalar query is both DISTINCT and contains an OFFSET clause.
2025-12-05  Increase the patch number to 3.51.2
2025-12-05  Ensure that the EXISTS-to-JOIN break happens even if the inner loop is a "no-op" loop that never executes more than once because it is controlled by a UNIQUE index.
2025-12-01 stephan Fix a potential UAF in sqlite3.oo1.DB.exec()'s teardown pieces.
2025-11-28  Version 3.51.1
2025-11-28  A better fix for the issue with RETURNING triggers on eponymous virtual tables and SQLITE_SCHEMA errors.
2025-11-28  Fix a buffer overread in fts5 that might occur while processing a corrupt db.
2025-11-28  Fix a problem in the xFilter() method of the fts5_vocab virtual table causing it to omit some result rows in some cases where a virtual cursor is used more than once by SQLite.
2025-11-13  CLI shell: ensure that .dump propagates its error code on error.
2025-11-13  Fix a problem in the EXISTS-to-JOIN optimization so that it works with nested WHERE and EXISTS statements.
2025-11-13  Merge various minor code and documentation fixes from trunk into the patch branch for 3.51.
2025-11-09 stephan Kick off branch-3.51: bump version to 3.51.1 and cherrypick [0f712b6b0516dc151d].
2025-11-04  Version 3.51.0
2025-11-03  Use the same compile-time options for the CLI in the auto-setup tarball as are used in the canonical source tree. [forum:/forumpost/8975130218|Forum post 8975130218].
2025-11-03 Dan Kennedy Add new column "cwd" to the jobs table in testrunner.db. For recording the directory in which the test ran or is running.
2025-11-03  Adjust the dbstatus2.test module so that it works on 32-bit builds in addition to 64-bit builds.
2025-11-03  Update test result output from test/dbstatus2.test module so that it reports the actual value of nTmpSpill when that value is out of range.
2025-11-03  Fix the test/speedtest.tcl script so that the CC= command-line option works.
2025-11-03  Fix a harmless memory leak in the CLI caused by the --cmd option generating an error message.
2025-11-02  Add pedantic OOM detection logic to some disused diagnostic and test code. No changes to any deliverables.
2025-11-01  Update the test/walthread.test testing script so that it uses a random database name.
2025-11-01 stephan Fix ext/wasm/mkdist.sh to use ./version-info instead of ../../version-info (a recent build change made to ensure that builds with a custom sqlite3.c embed that version info).
2025-10-31  Updates to the compile-for-windows.md document.  No changes to code.
2025-10-31 Dan Kennedy Detect some cases of ambiguous column references in USING clauses that can come up with nested joins.
2025-10-31  Change the name of a file-scope constant array in carray.c so that it does not conflict with other variables names in other files when carray.c is amalgamated.  This is down to resolve a harmless compiler warning.
2025-10-31  Update the main README.md file to use the robot-safe /rchvdwnld page on the server for downloads.
2025-10-31  Fix the output of ".dump" in the CLI so that the sqlite_sequence table is created using correct syntax.
2025-10-30  New assert() statements to help out static analyzers.
2025-10-30 stephan Add SQLITE_OMIT_WAL checks around some functions to avoid defining unused statics in such builds. Fixes OMIT_WAL builds on msys2 and passes tool/omittest-msvc.tcl.
2025-10-30  Further improvements the ".dump" command to handle corner cases.
2025-10-30 stephan Another (void), as per [dd6edfc09434].
2025-10-30 stephan Add (void) to two places for the sake of SQLITE_OMIT_WAL builds. Why these do not complain on tests in this tree, but do on a downstream tree (same machine, same compiler), is a mystery.
2025-10-30 stephan wasm: re-add SQLITE_OMIT_WAL to the c-pp-lite build flags.
2025-10-30 stephan Macro tweaks to get SQLITE_OMIT_WAL building. Remove some nearby stray EOL whitespace.
2025-10-30  Fix a typo and improve wording in README.md
2025-10-30  Updates to the tool/warnings.sh script for better compiler warnings.
2025-10-30  Fix a harmless compiler warning associated with flexarrays.
(...)
2025-06-09  Adjustments to ext/misc/fileio.c in an attempt to get it to build using mingw.
2025-06-06  Remove unnecessary whitespace and otherwise improve comments in the wherecode.c module.  No coding changes.
2025-06-06  Update the "msort" function in Lemon so that it works with lists of any length, and also so that the sort is stable.  This patch was motivated by [forum:/forumpost/63750d717c9ed961|forum post 63750d717c] but was independently developed, then tested by temporarily setting LISTSIZE to 2.
2025-06-05  Remove the clunky test_windirent.h and test_windirent.c files from src/ and replace them with a much cleaner and more compact ext/misc/windirent.h.
2025-06-05  Enhance the FSDIR virtual table with a new "level" column.  The query planner knows how to optimize to avoid search deeper than the maximum requested level.
2025-06-04 stephan tea build: add an info-exists check after a 'scan' call, as scan does not create its target vars on error. Problem reported at [forum:fde857fb8101a4be | forum post fde857fb8101a4be] and triggers when the 'vsatisfies' test for the host's Tcl version fails (so the build would fail anyway, but will fail more informatively with this fix).
2025-06-03 stephan Apply the duplicate 'export default' workaround to the (untested and unsupported) node-specific build rules in mkwasmbuilds.c to resolve a problem reported off-list by Thomas Steiner.
2025-06-03  Enhance sqlite3_rsync so that it works even if the replica database is initially malformed.
2025-06-03  Fix an off-by-one error in sqlite3_rsync, reported in [forum:/forumpost/b6d78f60fc|forum post b6d78f60fc].
2025-06-03  Fix harmless compiler warning introduced by the setlk-snapshot-fix merge.
2025-06-02  Fix JSONB edit so that when it is trying to reduce the size of an element it understands 0xf0 (8-byte) sizes.
2025-06-02  Increase the version number to 3.51.0
2025-06-02 Dan Kennedy Fix os_win.c so that SQLITE_ENABLE_SETLK_TIMEOUT=2 builds work on windows.
2025-06-02  Improve the accuracy of affinity and collating sequence analysis for NATURAL JOINs to the left of RIGHT JOINs where source tables are views or subqueries.  Initial problem report in [forum:/forumpost/829306db47|forum post 829306db47].
2025-06-02 Dan Kennedy Updates to new test cases to run with SQLITE_ENABLE_SETLK_TIMEOUT=2 builds.
2025-06-02 stephan Slight modernization of the TEA README.txt.
2025-06-02 stephan TEA: remove the stale man page and references to the MSC makefiles from the README.txt. Based on discussion at [forum:87e6660191a472c5 | forum post 87e6660191a472c5].  A couple of weeks ago we internally discussed pulling in the MSC makefiles from the 3.49 tree but they are stale and possibly unused, so opted against it for the time being.
2025-06-02  Remove an unnecessary parameter from sqlite3VdbeRecordUnpack().  Improved comments and assert()s on KeyInfo.
2025-06-02  Fix stale comments related to KeyInfo.  Add new assert()s associated with memory management of KeyInfo.
2025-06-01  Fix an off-by-one error in the size computation of a vdbe-sorter. [forum:/forumpost/c1cc8b057a|Forum post c1cc8b057a]. Problem introduced by checkin [d4307a0d43f42e96].
2025-06-01  Fix VACUUM so that it works even when ATTACH_WRITE is disabled.
2025-05-31  Enhance "box" and "column" mode formatting in the CLI to better deal with double-wide characters.
2025-05-31 Dan Kennedy Update a few test scripts so that they run on windows.
2025-05-31  New makefile target "xdevtest" works like "releasetest" except that it omits the "verify-source" dependency so that it can be run with uncommitted changes in the source tree.
2025-05-31 Dan Kennedy Fix an affinity problem caused by a USING or NATURAL JOIN on the LHS of a FULL JOIN. [forum:/forumpost/5028c785b6|Forum post 5028c785b6].
2025-05-31  Relax query flattener constraint (3b) and thereby allow flattening the RHS of a LEFT JOIN even if the RHS contains a virtual table.  This was previously disallowed by [9dbae1df75219e2a] as a performance optimization.  It turns out that the constraint causes performance issues, and we do not have a record of any performance issue that it solves.
2025-05-31 Dan Kennedy Fix assert() statements in os_unix.c and os_win.c. Allow walsetlk_recover.test to run in non-SQLITE_ENABLE_SNAPSHOT builds.
2025-05-31 stephan Move a mis-located makefile comment block.
2025-05-31 stephan tcl extension: UDFs may now 'break' to return an SQL NULL. Add the (eval -asdict) flag to use a dict, instead of an array, for the eval row data.
2025-05-31 stephan Add some missing UNUSED_PARAMETER() annotations to squelch downstream build warnings when using -Wextra -pedantic.
2025-05-30  Follow-up to the previous:  The same optimization suppression needs to happen if the left-hand side is coming from a LEFT JOIN.
2025-05-30 Dan Kennedy If blocking locks are enabled, avoid using the busy handler when blocked by another process running recovery.
2025-05-30  When synthesizing an ON constraint from a USING or NATURAL, if the left-hand side is coming from a RIGHT JOIN, be sure to set the EP_CanBeNull flag so that the optimizer knows to check for NULL even if the column has a NOT NULL constraint.  Fix for the problem reported by [forum:/forumpost/4fc70203b61c7e12|forum post 4fc70203b61]
2025-05-30 Dan Kennedy Avoid invoking the busy-handler if a blocking lock times out while attempting to open a snapshot transaction.
2025-05-30 stephan Configure-related fixes and additions, most notably integration of self-tests for proj.tcl's APIs. Teaish make-install fixes based on the discussion in [forum:87e6660191a472c5 | forum thread 87e6660191a472c5].
2025-05-30 stephan Random typo fixes in JNI docs.
2025-05-30  Use a more robust backup definition for offsetof().
2025-05-30 Dan Kennedy Add "include <stddef.h>" to fts5 and rtree to ensure that they use the system version of the offsetof() macro when it is available, as the built-in version triggers ubsan errors with clang.
2025-05-30 stephan Squelch an interesting but harmless struct initialization warning emitted after an emsdk update. Fix JS breakage introduced by changes in Emscripten 4.0.7: manually export the HEAPxyz symbols which used to be exposed by default.
2025-05-29 stephan Fix the missing -lm link flag for the sqlite3 shell when building the autoconf bundle with --disable-static-shell, as reported in [forum:5adf1c932a | forum post 5adf1c932a].
2025-05-29  Extend the fix for ticket [623eff57e76d45f6] so that it covers RIGHT JOIN in addition to LEFT JOIN.  Problem reported by [forum:/forumpost/7dee41d32506c4ae|forum post 2025-05-29T15:10:14Z].
2025-05-29  Fix a goofy hash function in Lemon.  No changes to SQLite itself.
2024-06-20  Do not attempt the exists-to-join optimization if the FROM clause is full.
2024-06-14 Dan Kennedy Add tests for the change on this branch.
2024-06-12 Dan Kennedy Do not attempt the exists-to-join optimization for expressions from the ON clause of joins.
2024-06-11  Provide the ability to disable the exists-to-join optimization using SQLITE_TESTCTRL_OPTIMIZATIONS.  Provide tree-trace output for the optimization.
2024-06-10 Dan Kennedy Add missing calls to sqlite3exprSkipCollateAndLikely() to the enchancement on this branch.
2024-06-10 Dan Kennedy Fix a crash that could occur when the SELECT in an EXISTS(SELECT ...) used an unknown collation sequence.
2024-06-08 Dan Kennedy Add extra tests for the changes on this branch.
2024-06-07 Dan Kennedy Experimental optimization to rewrite a SELECT with an EXISTS(...) expression in the WHERE clause as a join.

Created with:
  roll-dep src/third_party/sqlite/src

Change-Id: I30c811b0859b4b76c4a3fd09f3c49aec2a4036c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7566883
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Auto-Submit: Greg Thompson <grt@chromium.org>
Reviewed-by: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1583239}
NOKEYCHECK=True
GitOrigin-RevId: b8e1904339728cbb8f2964172f82984267e5136c
2 files changed
tree: facd8e98d90d96ff2a91a11848a3bd9f23e1ae72
  1. dev/
  2. fuzz/
  3. scripts/
  4. .gitignore
  5. BUILD.gn
  6. DEPS
  7. DIR_METADATA
  8. LICENSE
  9. OWNERS
  10. PRESUBMIT.py
  11. README.chromium
  12. README.md
  13. sqlite3.h
  14. sqlite3_shim.c
  15. sqlite3_shim_fixups.h
  16. sqlite_chromium_configuration_flags.gni
  17. sqlite_common_configuration_flags.gni
  18. sqlite_dev_configuration_flags.gni
  19. sqlite_shell_icu_helper.cc
  20. sqlite_shell_icu_helper.h
  21. sqlite_shell_shim.c
README.md

Chromium SQLite.

This is the top folder for Chromium's SQLite. The actual SQLite source is not in this repository, but instead cloned into the src directory from https://chromium.googlesource.com/chromium/deps/sqlite.

The directory structure is as follows. Files common to all third_party projects (ex. BUILD.GN, OWNERS, LICENSE) are omitted.

  • src/ The Chromium fork of SQLite (cloned via top level DEPS file).
  • scripts/ Scripts that generate the files in the amalgamations in src/.
  • sqlite.h The header used by the rest of Chromium to include SQLite. This forwards to src/amalgamation/sqlite3.h
  • fuzz/ Google OSS-Fuzz (ClusterFuzz) testing for Chromium's SQLite build.

Amalgamations

SQLite amalgamations are committed to the SQLite Chromium repository (in src), but are created by a script that lives in the Chromium repository. This is because the configuration variables for building and amalgamation generation are shared.

There are two amalgamations:

  • //third_party/sqlite/src/amalgamation is shipped, tested, and Fuzzed by Chromium.
  • //third_party/sqlite/src/amalgamation_dev is not distributed or tested by Chromium. It is used for some developer tools (either only for local development, or only on trusted input).

//third_party/sqlite/src repository.

CLs in this repository cannot be submitted through the commit queue (ex. CQ+2), because there is no commit queue / try bot support for this repository. Please use the “Submit” button (in Gerrit's 3-dot menu on the top right) to submit CLs in this repository instead.

Playbook

Upgrade to a new SQLite release.

SQLite should be upgraded as soon as possible whenever a new version is available. This is because new versions often contain security and stability improvements, and frequent upgrades allow Chromium to have minimal cherry-pick diffs when requesting investigation for SQLite bugs discovered by Chromium Fuzzers. New versions may be viewed here, and bugs for these upgrades may look like this example.

Historically, Chromium fuzzers often find issues within 2 weeks after upgrading to new SQLite versions. Avoid upgrading SQLite within 1-2 weeks of a Chromium branch point to allow fuzzers time to run. However, if the new SQLite release contains known security or stability fixes, upgrade once available and monitor fuzzers more closely.

SQLite version upgrades tend to be extremely large changes (example), for which the diffs are not possible to thoroughly review.

Note SQLite tags all releases version-<release number>, e.g. version-3.40.0. The Chromium project prefixes all tags/branches with “chromium-”, e.g. chromium-version-3.40.0.

  1. Create new release branch

    Request creation of a new release branch via a Git Admin Request with a message along the lines of: “Please create branch chromium-version-3.50.0 in the chromium/deps/sqlite repo based on commit refs/tags/upstream/version-3.50.0.” See Gerrit/branches to view existing branches.

  2. Checkout the new Chromium release branch.

    Get the version from the README.chromium.

    cd third_party/sqlite/src  # from //chromium/src
    git fetch origin
    export VERSION=3.40.0
    git checkout -b chromium-version-$VERSION \
        --track origin/chromium-version-$VERSION
    
  3. Generate and commit the SQLite amalgamations.

    ./../scripts/generate_amalgamation.py
    git add amalgamation amalgamation_dev
    git commit -m "Amalgamations for release $VERSION"
    
  4. Run local tests.

    Follow steps in Running Tests below to execute all verifications and tests.

  5. Upload the new release branch for review.

    git cl upload
    
  6. Roll the Chromium DEPS file.

    Once review above has merged:

    1. Roll the chromium/src/DEPS file to reference that new commit hash.
      roll-dep src/third_party/sqlite/src --roll-to <git hash of merged CL>
      
    2. Update the version in //third_party/sqlite/README.chromium. Amend the commit created by roll-dep above.

Cherry-pick unreleased commit from SQLite.

Sometimes critical fixes land in SQLite's master, but are not yet in a release. This may occur when other SQLite embedders find critical security or stability issues that SQLite authors then fix, but are often detected by Chromium ClusterFuzz as well.

If you're triaging a ClusterFuzz bug, an internal playbook on how to triage and fix ClusterFuzz bugs is available at go/sqlite-clusterfuzz-bug-process.

If changes need to be brought into the current release branch, please do the following:

  1. Checkout the current release branch.

    Get the version from the README.chromium.

    export VERSION=3.40.0
    cd third_party/sqlite/src  # from //chromium/src
    git checkout -b chromium-version-$VERSION \
      --track origin/chromium-version-$VERSION
    
  2. Cherry-pick the change

    Git can be used to cherry pick upstream changes into a release branch but the sqlite_cherry_picker.py script is preferred. This script automates a few tasks such as:

    • Identifying the correct Git commit hash to use if given the Fossil commit hash.
    • Automatically calculating Fossil manifest hashes.
    • Skipping conflicted binary files.
    • Generating the amalgamations.

    Cherry-pick the commit:

    ../scripts/sqlite_cherry_picker.py <full git commit hash>
    

    If there is a conflict that the script cannot resolve then, like git cherry-pick, the script will exit and leave you to resolve the conflicts. Once resolved run the script a second time:

    ../scripts/sqlite_cherry_picker.py --continue
    

    If you have access to the SQLite fossil commit hash, and would like to map this to the corresponding git hash, you can use GitHub search. As SQLite‘s git repository’s commits include the fossil hash, you can search for the fossil hash, using the following query with the fossil commit hash appended (example search): https://github.com/sqlite/sqlite/search?type=commits&q=

    If the cherry-picking script is unable to cherry-pick a commit, like in https://crbug.com/1162100, manually apply the change from a SQLite or git, in //third_party/sqlite/src's files modified in the SQLite tracker, like at https://sqlite.org/src/info/a0bf931bd712037e. From there, run ../scripts/generate_amalgamation.py to propagate these changes over to the amalgamation files. sqlite_cherry_picker.py should generally be preferred, as it updates hashes and simplifies tracking.

  3. Run local tests.

    Follow steps in Running Tests below to execute all verifications and tests.

  4. Upload cherry-picked change (with amalgamations) for review.

If the relevant bug is a security bug, make sure that the reviewers are cc‘ed. Otherwise, they may not know what/why they’re reviewing.

```sh
git cl upload
```
  1. Update the Chromium DEPS file.

    Once review above has merged, roll the chromium/src/DEPS file to reference that new commit hash.

    roll-dep src/third_party/sqlite/src --roll-to <git hash of merged CL>
    

Running Tests

Build all desktop targets:

Check that extract_sqlite_api.py added “chrome_” to all exported symbols. Only “_fini” and “_init” should be unprefixed, but are conditionally exported by the linker and may be omitted.

autoninja -C out/Default
nm -B out/Default/libthird_party_sqlite_chromium_sqlite3.so | cut -c 18- | sort | grep '^T'

Running unit tests

out/Default/sql_unittests

Running SQLite's TCL test suite within the Chromium checkout.

This is one of the SQLite test suites. They take approximately 3 minutes to build and run on a fast workstation.

Note: Tests currently fail both locally and on Chromium release branches. They fail on release branches because some tests rely on SQLite databases (binary files) which are committed to the source and are likely not merged down when cherry picked. It is safe to ignore these errors which should be reasonably easy to identify based on the cherry picked upstream changes. Until these tests are fixed, it is safe to ignore these tests when running SQLite test suites.

cd third_party/sqlite  # from //chromium/src
./scripts/generate_amalgamation.py --testing
make --directory=src test | tee /tmp/test.log

Show tests with errors:

egrep 'errors out of' /tmp/test.log

Show broken tests:

egrep 'Failures on these tests:' /tmp/test.log

Broken tests will also show lines ending in “...” instead of “... Ok”.

When done, clean up the SQLite repository:

cd src
make clean
git clean -i  # and delete everything
rm -rf testdir
git checkout amalgamation/sqlite3.c
git checkout amalgamation_dev/sqlite3.c

Bisect SQLite

When diagnosing the cause of an issue found in a fuzzer issue or while bringing up SQLite, you may want to bisect the SQLite repo.

To find the SQLite commit that introduced an issue the scripts/repro_tool.py can be used in combination with git bisect run.

For example, given a good commit of 9e45bccab2b8, a bad commit of c12b0d5b7135, and a reproduction sql file repro.sql, running the following will pinpoint the commit that introduced the failure:

cd src
git bisect start c12b0d5b7135 9e45bccab2b8
git bisect run ../scripts/repro_tool.py repro.sql

The reproduction file can be omitted if it is a build error. --should_build can be passed to repro_tool.py if the issue is not a build error and we don't want to continue bisecting if a build does fail.

See scripts/repro_tool.py --help for more information.