You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sqlcipher_export_init declared with the wrong type #590
sqlcipher_export_init is registered as an sqlite "auto extension" function, of which the intended type is the following:
typedef int (*sqlite3_loadext_entry)(
sqlite3 *db, /* Handle to the database. */
char **pzErrMsg, /* Used to set error string on failure. */
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
);
Note the second parameter is const char* instead of char*. We came across this problem because UBSAN ("undefined behavior sanitizer") flags this as a mismatched function call at runtime. I don't think it has any practical downside, since errmsg is unused in sqlcipher_export_init, but it is worth fixing so the sanitizer doesn't complain.
Also, just to follow up, the reason this doesn't throw a compiler error is because sqlite stores these functions as some generic pointer type, (void)(*)(void), and then casts back to sqlite3_loadext_entry before it invokes it. Because of this behavior, the mismatch gets lost by the compiler.
Activity
mmaxim commentedon Mar 19, 2026
Also, just to follow up, the reason this doesn't throw a compiler error is because sqlite stores these functions as some generic pointer type,
(void)(*)(void), and then casts back tosqlite3_loadext_entrybefore it invokes it. Because of this behavior, the mismatch gets lost by the compiler.sjlombardo commentedon Mar 19, 2026
Hello @mmaxim - thanks for reporting this issue. It will be resolved in the next release of SQLCipher. We'll leave this issue open until then.
This highlights a discrepancy in SQLite's Automatically Load Statically Linked Extensions documentation which calls for the entry point to be:
You might also consider reporting the difference on the SQLite forum to have the documentation corrected in the official documentation.
Removes const from pzErrMesg in sqlcipher_export_init
sjlombardo commentedon Apr 28, 2026
Hello @mmaxim this should be resolved in 4.15.0. Thanks again for the report!