-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This was originally reported as a problem in APSW (Python SQLite wrapper):

  https://github.com/rogerbinns/apsw/issues/184

The important bits are that a cursor (sqlite3_stmt) is created, and
step called once, but *not* reset or finalised:

  cursor.execute('SELECT * FROM TEMP.vt')

Then the the virtual table is dropped (different sqlite3_stmt):

  db.cursor().execute('DROP TABLE TEMP.vt')

Finally sqlite3_step is called on the sqlite3_stmt from earlier which
causes a segfault:

  rc = pModule->xNext(pCur->pVtabCursor);

This is because pModule is now null.

I can't think of any way I can realistically prevent this from
happening.  SQLite really should prevent it from happening by
disallowing the deletion of virtual tables with open statements.

I did the same steps using a real (non-virtual table) and on trying to
drop the table with open statements get:

  LockedError: database table is locked

Virtual tables should behave the same way.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlUQoswACgkQmOOfHg372QSlPACgsgh/75SnQWAzhwE+HXrM5If8
SxwAoI0UTwCYJS/yTzIm3/BD45+lCPG6
=TWTA
-----END PGP SIGNATURE-----

Reply via email to