Fix use-after-free crash in SQLite extension (#481)

When the server crashed and the process got terminated, the SqDriver
instance was killed first (e.g. by atexit). SqDatabase tries to access
SqDriver in its destructor.
This patch tells SqDatabase to not use anything from SqDriver anymore
after SqDriver got destroyed.

Next to that, the clientprefs extension relied on the IDatabase pointer
being valid to get the driver pointer. Cache the pointer, so the dbi
system still knows the IDBThreadOperation belonged to the now gone
driver, even after the database object is gone.
This commit is contained in:
peace-maker
2016-10-03 16:31:17 +01:00
committed by Asher Baker
parent 2deaa666f3
commit 47eb7d60e5
5 changed files with 38 additions and 1 deletions
+4
View File
@@ -64,6 +64,10 @@ public:
bool SetCharacterSet(const char *characterset);
public:
sqlite3 *GetDb();
void PrepareForForcedShutdown()
{
m_Persistent = false;
}
private:
sqlite3 *m_sq3;
ke::AutoPtr<ke::Mutex> m_FullLock;