diff options
author | stephan <stephan@noemail.net> | 2023-08-11 14:31:20 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-08-11 14:31:20 +0000 |
commit | 7e131529526d1f86689f1e9a3d07adac87bf21c3 (patch) | |
tree | d4d3cb0a7bca91e507c70ae71568f43b02b66a5c /ext/wasm/api | |
parent | 59d01de837f5c094d88a106690487a571887c9df (diff) | |
download | sqlite-7e131529526d1f86689f1e9a3d07adac87bf21c3.tar.gz sqlite-7e131529526d1f86689f1e9a3d07adac87bf21c3.zip |
Deprecate sqlite3_js_vfs_create_file() because, it was discovered today, its out-of-scope use of the sqlite3_vfs, sqlite3_file, and sqlite3_io_methods APIs triggers unresolvable assertions in the core when built with SQLITE_DEBUG.
FossilOrigin-Name: f3647a3ac8eca8c821b0b1e403da7bfb0feabd0eb5ee83709cd4956dfc56a492
Diffstat (limited to 'ext/wasm/api')
-rw-r--r-- | ext/wasm/api/sqlite3-api-prologue.js | 6 | ||||
-rw-r--r-- | ext/wasm/api/sqlite3-wasm.c | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js index 3b29041c3..fe167f025 100644 --- a/ext/wasm/api/sqlite3-api-prologue.js +++ b/ext/wasm/api/sqlite3-api-prologue.js @@ -1357,6 +1357,12 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( }; /** + Achtung: this function does not work in debug builds of sqlite3 + because its out-of-scope use of the sqlite3_vfs API triggers + unresolvable assertions in the core library. That was + unfortunately not discovered until 2023-08-11. Because of that, + this function is now deprecated and should be used in new code. + Creates a file using the storage appropriate for the given sqlite3_vfs. The first argument may be a VFS name (JS string only, NOT a WASM C-string), WASM-managed `sqlite3_vfs*`, or diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c index 94b16d750..431eddceb 100644 --- a/ext/wasm/api/sqlite3-wasm.c +++ b/ext/wasm/api/sqlite3-wasm.c @@ -295,7 +295,7 @@ SQLITE_WASM_EXPORT void * sqlite3_wasm_pstack_ptr(void){ */ SQLITE_WASM_EXPORT void sqlite3_wasm_pstack_restore(unsigned char * p){ assert(p>=PStack.pBegin && p<=PStack.pEnd && p>=PStack.pPos); - assert(0==(p & 0x7)); + assert(0==((unsigned long long)p & 0x7)); if(p>=PStack.pBegin && p<=PStack.pEnd /*&& p>=PStack.pPos*/){ PStack.pPos = p; } @@ -1395,6 +1395,12 @@ int sqlite3_wasm_vfs_create_file( sqlite3_vfs *pVfs, const char *zFilename, const unsigned char * pData, int nData ){ +#ifdef SQLITE_DEBUG + fprintf(stderr,"%s does not work in debug builds because its out-of-scope use of " + "the sqlite3_vfs API triggers assertions in the core library.\n", __func__); + /* ^^^ That was unfortunately not discovered until 2023-08-11. */ + return SQLITE_ERROR; +#else int rc; sqlite3_file *pFile = 0; sqlite3_io_methods const *pIo; @@ -1462,6 +1468,7 @@ int sqlite3_wasm_vfs_create_file( sqlite3_vfs *pVfs, RC; #undef RC return rc; +#endif } /* |