Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a crash that can occur after a malloc failure. Ticket #2775. (CVS 4547) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c91bc8d33306881cb2501070dccced92 |
User & Date: | danielk1977 2007-11-16 14:55:46.000 |
Context
2007-11-17
| ||
22:23 | Fix a bug in the grammar. We were giving the ones-complement operator ~ the same precedence as the NOT operator, which is incorrect. (CVS 4548) (check-in: b48a4bfd32 user: drh tags: trunk) | |
2007-11-16
| ||
14:55 | Fix a crash that can occur after a malloc failure. Ticket #2775. (CVS 4547) (check-in: c91bc8d333 user: danielk1977 tags: trunk) | |
00:23 | Don't do anything when input doclists are both empty. Ticket #2774 (CVS 4546) (check-in: 75cb46f82a user: shess tags: trunk) | |
Changes
Changes to src/trigger.c.
︙ | ︙ | |||
769 770 771 772 773 774 775 776 777 778 779 780 | assert(op == TK_UPDATE || op == TK_INSERT || op == TK_DELETE); assert(tr_tm == TRIGGER_BEFORE || tr_tm == TRIGGER_AFTER ); assert(newIdx != -1 || oldIdx != -1); for(p=pTab->pTrigger; p; p=p->pNext){ int fire_this = 0; /* Determine whether we should code this trigger */ if( p->op==op && p->tr_tm==tr_tm && | > | | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | assert(op == TK_UPDATE || op == TK_INSERT || op == TK_DELETE); assert(tr_tm == TRIGGER_BEFORE || tr_tm == TRIGGER_AFTER ); assert(newIdx != -1 || oldIdx != -1); for(p=pTab->pTrigger; p; p=p->pNext){ int fire_this = 0; sqlite3 *db = pParse->db; /* Determine whether we should code this trigger */ if( p->op==op && p->tr_tm==tr_tm && (p->pSchema==p->pTabSchema || p->pSchema==db->aDb[1].pSchema) && (op!=TK_UPDATE||!p->pColumns||checkColumnOverLap(p->pColumns,pChanges)) ){ TriggerStack *pS; /* Pointer to trigger-stack entry */ for(pS=pParse->trigStack; pS && p!=pS->pTrigger; pS=pS->pNext){} if( !pS ){ fire_this = 1; } |
︙ | ︙ | |||
812 813 814 815 816 817 818 | trigStackEntry.pNext = pParse->trigStack; trigStackEntry.ignoreJump = ignoreJump; pParse->trigStack = &trigStackEntry; sqlite3AuthContextPush(pParse, &sContext, p->name); /* code the WHEN clause */ endTrigger = sqlite3VdbeMakeLabel(pParse->pVdbe); | | | | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | trigStackEntry.pNext = pParse->trigStack; trigStackEntry.ignoreJump = ignoreJump; pParse->trigStack = &trigStackEntry; sqlite3AuthContextPush(pParse, &sContext, p->name); /* code the WHEN clause */ endTrigger = sqlite3VdbeMakeLabel(pParse->pVdbe); whenExpr = sqlite3ExprDup(db, p->pWhen); if( db->mallocFailed || sqlite3ExprResolveNames(&sNC, whenExpr) ){ pParse->trigStack = trigStackEntry.pNext; sqlite3ExprDelete(whenExpr); return 1; } sqlite3ExprIfFalse(pParse, whenExpr, endTrigger, 1); sqlite3ExprDelete(whenExpr); |
︙ | ︙ |
Changes to test/malloc.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # This file attempts to check the behavior of the SQLite library in # an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, # the SQLite library accepts a special command (sqlite3_memdebug_fail N C) # which causes the N-th malloc to fail. This special feature is used # to see what happens in the library if a malloc were to really fail # due to an out-of-memory situation. # | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file attempts to check the behavior of the SQLite library in # an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, # the SQLite library accepts a special command (sqlite3_memdebug_fail N C) # which causes the N-th malloc to fail. This special feature is used # to see what happens in the library if a malloc were to really fail # due to an out-of-memory situation. # # $Id: malloc.test,v 1.52 2007/11/16 14:55:46 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { |
︙ | ︙ | |||
140 141 142 143 144 145 146 | } {0} ifcapable trigger { do_malloc_test 5 -sqlbody { BEGIN TRANSACTION; CREATE TABLE t1(a,b); CREATE TABLE t2(x,y); | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | } {0} ifcapable trigger { do_malloc_test 5 -sqlbody { BEGIN TRANSACTION; CREATE TABLE t1(a,b); CREATE TABLE t2(x,y); CREATE TRIGGER r1 AFTER INSERT ON t1 WHEN new.a = 2 BEGIN INSERT INTO t2(x,y) VALUES(new.rowid,1); INSERT INTO t2(x,y) SELECT * FROM t2; INSERT INTO t2 SELECT * FROM t2; UPDATE t2 SET y=y+1 WHERE x=new.rowid; SELECT 123; DELETE FROM t2 WHERE x=new.rowid; END; |
︙ | ︙ |