Visitar URL original
Guard `BtShared.nRef` reads with `SQLITE_OMIT_SHARED_CACHE` by LucaCappelletti94 · Pull Request #628 · sqlcipher/sqlcipher · GitHub
Skip to content

Guard BtShared.nRef reads with SQLITE_OMIT_SHARED_CACHE - #628

Open
LucaCappelletti94 wants to merge 1 commit into
sqlcipher:betafrom
LucaCappelletti94:upstream/omit-shared-cache-nref
Open

LucaCappelletti94 wants to merge 1 commit into
sqlcipher:betafrom
LucaCappelletti94:upstream/omit-shared-cache-nref

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

SQLCipher 5.0.0-beta.1 no longer compiles with SQLITE_OMIT_SHARED_CACHE. The shared-cache fix in 1825a0a reads BtShared.nRef in the cipher_migrate refusal and in an assert in sqlcipher_ctx_set_error, and SQLite declares nRef only when shared cache is compiled in. Builds that omit shared cache, such as the sqlite-wasm-rs Wasm build, stop with 'BtShared' has no member named 'nRef'.

Both reads now sit under #ifndef SQLITE_OMIT_SHARED_CACHE, the same guard SQLite puts around the field. Without shared cache Btree.sharable is never set, so ctx->shared stays 0 and neither check could fire. Builds with shared cache compile exactly the code they did before.

The shared-cache tests in the core, compatibility and rekey suites are skipped with ifcapable shared_cache when shared cache is omitted, since a cache=shared URI then opens a private cache and those tests cannot hold. That lets the SQLCipher suite run on a build without shared cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant