SQLitePCL.raw
SQLitePCL.raw copied to clipboard
AccessViolationException using sqlcipher
If the sqlcipher key is set > 1 times (even if the key is the same) on the same connection, the next SQL statement that gets executed will give an AccessViolationException.
To recreate:
- Create a console project and add a nuget reference to SQLitePCLRaw.bundle_sqlcipher
- Replace the code in the code file with
using System.IO;
using SQLitePCL;
namespace SQLiteRawPCLSqlCipherCrash
{
class Program
{
static void Main()
{
if (File.Exists("Test.sqlite"))
File.Delete("Test.sqlite");
Batteries_V2.Init();
sqlite3 db;
raw.sqlite3_open("Test.sqlite", out db);
string error;
raw.sqlite3_exec(db, "PRAGMA key = 'password'", out error);
raw.sqlite3_exec(db, "PRAGMA key = 'password'", out error);
raw.sqlite3_exec(db, "CREATE TABLE Test (T int)", out error);
}
}
}
This should crash once the create table statement runs
I have reproduced this.
What I don't know yet is whether this behavior is specific to SQLitePCL.raw, or if the same thing happens when using sqlcipher from, say, C.
Closing old/stale issue.