aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-12-02 18:56:37 +0000
committerstephan <stephan@noemail.net>2022-12-02 18:56:37 +0000
commitbb4e4a4840530da37c6fdaabc9769a1996f25809 (patch)
treea272b6dcedc0fc44f32f59d60df18b46ce8eb09e /ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
parent95bc4d67bbc8abe0783605e5f98dc1689d213352 (diff)
downloadsqlite-bb4e4a4840530da37c6fdaabc9769a1996f25809.tar.gz
sqlite-bb4e4a4840530da37c6fdaabc9769a1996f25809.zip
Minor internal tweaks to the OPFS VFS. Resolve a missing result code which lead to a null deref in xFileSize().
FossilOrigin-Name: 57dd593ef0efa17dfb3a9f4eac36d5b8b879e271de817d8cd94a8c8b56d31870
Diffstat (limited to 'ext/wasm/api/sqlite3-vfs-opfs.c-pp.js')
-rw-r--r--ext/wasm/api/sqlite3-vfs-opfs.c-pp.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
index 85e65a4ae..4dc145a61 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
@@ -284,7 +284,7 @@ const installOpfsVfs = function callee(options){
noise for seemingly innocuous things like xAccess() checks
for missing files, so this option may have one of 3 values:
- 0 = no exception logging
+ 0 = no exception logging.
1 = only log exceptions for "significant" ops like xOpen(),
xRead(), and xWrite().
@@ -363,6 +363,7 @@ const installOpfsVfs = function callee(options){
[
'SQLITE_ACCESS_EXISTS',
'SQLITE_ACCESS_READWRITE',
+ 'SQLITE_BUSY',
'SQLITE_ERROR',
'SQLITE_IOERR',
'SQLITE_IOERR_ACCESS',
@@ -706,10 +707,15 @@ const installOpfsVfs = function callee(options){
},
xFileSize: function(pFile,pSz64){
mTimeStart('xFileSize');
- const rc = opRun('xFileSize', pFile);
+ let rc = opRun('xFileSize', pFile);
if(0==rc){
- const sz = state.s11n.deserialize()[0];
- wasm.setMemValue(pSz64, sz, 'i64');
+ try {
+ const sz = state.s11n.deserialize()[0];
+ wasm.setMemValue(pSz64, sz, 'i64');
+ }catch(e){
+ error("Unexpected error reading xFileSize() result:",e);
+ rc = state.sq3Codes.SQLITE_IOERR;
+ }
}
mTimeEnd();
return rc;
@@ -1160,7 +1166,7 @@ const installOpfsVfs = function callee(options){
[
/* Truncate journal mode is faster than delete for
this vfs, per speedtest1. That gap seems to have closed with
- Chome version 108 or 109, but "persist" is very roughly 5-6%
+ Chrome version 108 or 109, but "persist" is very roughly 5-6%
faster than truncate in initial tests. */
"pragma journal_mode=persist;",
/* Set a default busy-timeout handler to help OPFS dbs