Message304047
The following code causes a crash:
import sqlite3
connection = sqlite3.Connection.__new__(sqlite3.Connection)
connection.isolation_level
This is because pysqlite_connection_get_isolation_level() doesn't check whether
the Connection object is initialized.
pysqlite_connection_close() also doesn't check that, so we would get a crash
also if we replaced `connection.isolation_level` with `connection.close()`.
pysqlite_connection_set_isolation_level() doesn't crash in case of an
uninitialized Connection object, but it also doesn't raise an error, and IMHO
it should.
The following code causes a crash, too:
import sqlite3
try:
connection = sqlite3.Connection.__new__(sqlite3.Connection)
connection.__init__('', isolation_level='invalid isolation level')
except ValueError:
pass
connection.cursor()
This is because `self->initialized` is set to 1 in the beginning of
pysqlite_connection_init(), so after it fails, we are left with a partially
initialized Connection object whose `self->initialized` is 1. Thus,
pysqlite_connection_cursor() thinks that the Connection object is initialized.
Eventually pysqlite_connection_register_cursor() is called, and it crashes
while trying to append to `connection->cursors`, which is NULL. |
|
Date |
User |
Action |
Args |
2017-10-10 14:31:19 | Oren Milman | set | recipients:
+ Oren Milman |
2017-10-10 14:31:19 | Oren Milman | set | messageid: <1507645879.63.0.213398074469.issue31746@psf.upfronthosting.co.za> |
2017-10-10 14:31:19 | Oren Milman | link | issue31746 messages |
2017-10-10 14:31:19 | Oren Milman | create | |
|