This has already been fixed, see http://www.sqlite.org/cvstrac/tktview?tn=3603
Regards, Vivien 2009/2/4 Brodie Thiesfield <brofie...@jellycan.com> > Hi, > > I know that there has been a number of crashes involving > journal_mode = off. This problem continues for me in > sqlite 3.6.10 almalgamation though. A trigger seems to > be the cause. > > The following test program crashes on the last line > (sqlite3_step) with a NULL pointer dereference of > id->pMethods when compiled on Windows with VC2003. > > sqlite.c line 12576 > > SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int > amt, i64 offset){ > DO_OS_MALLOC_TEST; > return id->pMethods->xWrite(id, pBuf, amt, offset); > } > > If the prop table and associated triggers are removed, > the crash doesn't occur. > > Regards, > Brodie > > > The stack trace is: > > > testsqlite.exe!sqlite3OsWrite(sqlite3_file * id=0x00510b58, const > void * pBuf=0x0012e3e4, int amt=4, __int64 offset=0) Line 12576 + 0x1b > C > testsqlite.exe!write32bits(sqlite3_file * fd=0x00510b58, __int64 > offset=0, unsigned int val=4) Line 31128 + 0x17 C > testsqlite.exe!subjournalPage(PgHdr * pPg=0x00388a64) Line 33450 + > 0x1b C > testsqlite.exe!pager_write(PgHdr * pPg=0x00388a64) Line 34311 + 0x9 > C > testsqlite.exe!sqlite3PagerWrite(PgHdr * pDbPage=0x00388a64) Line > 34420 + 0x9 C > testsqlite.exe!insertCell(MemPage * pPage=0x00388e88, int i=0, > unsigned char * pCell=0x00388f20, int sz=9, unsigned char * > pTemp=0x00000000, unsigned char nSkip=0) Line 40971 + 0xc C > testsqlite.exe!sqlite3BtreeInsert(BtCursor * pCur=0x00385760, const > void * pKey=0x0051d698, __int64 nKey=8, const void * pData=0x004f6c22, int > nData=0, int nZero=0, int appendBias=0) Line 42175 + 0x19 C > testsqlite.exe!sqlite3VdbeExec(Vdbe * p=0x00386808) Line 52819 + > 0x2c C > testsqlite.exe!sqlite3Step(Vdbe * p=0x00386808) Line 47849 + 0x9 > C > testsqlite.exe!sqlite3_step(sqlite3_stmt * pStmt=0x00386808) Line > 47916 + 0x9 C > testsqlite.exe!main(int argc=1, unsigned short * * argv=0x00381d88) > Line 48 + 0x9 C++ > testsqlite.exe!mainCRTStartup() Line 259 + 0x19 C > kernel32.dll!7c817067() > ntdll.dll!7c915d27() > > > The test program is: > > #include <windows.h> > #include <assert.h> > #include <io.h> > #include <stdio.h> > #include "sqlite3.h" > > int main(int argc, TCHAR * argv[]) > { > sqlite3 * pDatabase = NULL; > char * pszError = NULL; > sqlite3_stmt * pStatement = NULL; > > unlink("test.sqlite"); > unlink("test.sqlite-journal"); > > assert(SQLITE_OK == sqlite3_open_v2("test.sqlite", > &pDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL)); > > assert(SQLITE_OK == sqlite3_exec(pDatabase, > "CREATE TABLE dic ( entryid INTEGER PRIMARY KEY AUTOINCREMENT NOT > NULL, headword TEXT NOT NULL, source TEXT NOT NULL ); " > "CREATE INDEX dic_headword_idx ON dic ( headword ); " > "CREATE TABLE prop ( pkey TEXT PRIMARY KEY NOT NULL, pval TEXT NOT > NULL ); " > "INSERT INTO prop(pkey, pval) VALUES ('total_count', 0); " > "CREATE TRIGGER count_insert_trigger AFTER INSERT ON [dic] FOR EACH > ROW BEGIN" > " UPDATE prop SET pval = pval + 1 WHERE pkey = 'total_count'; " > "END; " > "CREATE TRIGGER count_delete_trigger AFTER DELETE ON [dic] FOR EACH > ROW BEGIN" > " UPDATE prop SET pval = pval - 1 WHERE pkey = 'total_count'; " > "END; ", > NULL, NULL, &pszError)); > > assert(SQLITE_OK == sqlite3_close(pDatabase)); > > assert(SQLITE_OK == sqlite3_open_v2("test.sqlite", &pDatabase, > SQLITE_OPEN_READWRITE, NULL)); > > assert(SQLITE_OK == sqlite3_exec(pDatabase, > "PRAGMA journal_mode = OFF; " > "BEGIN IMMEDIATE TRANSACTION; ", > NULL, NULL, &pszError)); > > assert(SQLITE_OK == sqlite3_prepare_v2(pDatabase, > "INSERT INTO dic (entryid, headword, source) VALUES (?, ?, ?);", -1, > &pStatement, NULL)); > > assert(SQLITE_OK == sqlite3_bind_null(pStatement, 1)); > assert(SQLITE_OK == sqlite3_bind_text16(pStatement, 2, "foo", -1, > NULL)); > assert(SQLITE_OK == sqlite3_bind_text16(pStatement, 3, "bar", -1, > NULL)); > > assert(SQLITE_DONE == sqlite3_step(pStatement)); // crash here > > return 0; > } > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users