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
sqlite: authorizer can finalize another active statement and change outer statement outcome #65368
import{DatabaseSync,constants}from'node:sqlite';constdb=newDatabaseSync(':memory:');db.exec('CREATE TABLE t(x); INSERT INTO t VALUES (1), (2), (3)');constvictim=db.prepare('SELECT x FROM t');victim.iterate().next();// Leave its VM active.db.setAuthorizer((action)=>{if(action===constants.SQLITE_DROP_TABLE)victim.close();returnconstants.SQLITE_OK;});db.exec('DROP TABLE t');console.log('DROP TABLE succeeded');
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Finalizing another active statement from within the authorizer callback should be rejected or deferred. The active SELECT should continue holding its lock, causing DROP TABLE to fail with ERR_SQLITE_ERROR: database table is locked.
What do you see instead?
The script prints DROP TABLE succeeded. During authorization, the callback finalizes the active SELECT, releases its table lock, and allows the outer DROP TABLE to succeed.
Activity
sqlite: reject busy statement finalization in authorizer
sqlite: reject busy statement finalization in authorizer
sqlite: reject busy statement finalization in authorizer