Skip to content

sqlcipher_export_init declared with the wrong type #590

@mmaxim

Description

@mmaxim

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. */
);

However,sqlcipher_export_init is declared as:

static int sqlcipher_export_init(sqlite3* db, const char** errmsg, const struct sqlite3_api_routines* api) 

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions