diff options
author | James Turner <jturner@cvs.openbsd.org> | 2014-04-06 15:54:31 +0000 |
---|---|---|
committer | James Turner <jturner@cvs.openbsd.org> | 2014-04-06 15:54:31 +0000 |
commit | a01980da74b479ecbc06bdc452a042eac3b6d094 (patch) | |
tree | aefe4f5931ecd3027a3e81c6ef61e80ac2d0a408 /lib/libsqlite3 | |
parent | 356c2f23d2c8548f4dc494d79e73f69a9d7d3405 (diff) |
Update sqlite to 3.8.4.3. Recommended update to fix a problem that might
cause an incorrect query result and a potential buffer overread that
could corrupt a database file. Further details here:
http://sqlite.org/changes.html.
"sure ok" landry@
Diffstat (limited to 'lib/libsqlite3')
-rw-r--r-- | lib/libsqlite3/VERSION | 2 | ||||
-rw-r--r-- | lib/libsqlite3/ext/rtree/rtreeD.test | 57 | ||||
-rw-r--r-- | lib/libsqlite3/src/pragma.c | 6 | ||||
-rw-r--r-- | lib/libsqlite3/src/trigger.c | 2 | ||||
-rw-r--r-- | lib/libsqlite3/src/vdbe.h | 2 | ||||
-rw-r--r-- | lib/libsqlite3/src/vdbeaux.c | 1 | ||||
-rw-r--r-- | lib/libsqlite3/src/vdbeblob.c | 2 | ||||
-rw-r--r-- | lib/libsqlite3/src/where.c | 5 |
8 files changed, 70 insertions, 7 deletions
diff --git a/lib/libsqlite3/VERSION b/lib/libsqlite3/VERSION index ff313b8c212..a6a22749378 100644 --- a/lib/libsqlite3/VERSION +++ b/lib/libsqlite3/VERSION @@ -1 +1 @@ -3.8.4 +3.8.4.3 diff --git a/lib/libsqlite3/ext/rtree/rtreeD.test b/lib/libsqlite3/ext/rtree/rtreeD.test new file mode 100644 index 00000000000..c4a7d22e2e5 --- /dev/null +++ b/lib/libsqlite3/ext/rtree/rtreeD.test @@ -0,0 +1,57 @@ +# 2014 March 11 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Miscellaneous tests for errors in the rtree constructor. +# + + +if {![info exists testdir]} { + set testdir [file join [file dirname [info script]] .. .. test] +} +source [file join [file dirname [info script]] rtree_util.tcl] +source $testdir/tester.tcl +source $testdir/lock_common.tcl +ifcapable !rtree { + finish_test + return +} +set testprefix rtreeD + +#------------------------------------------------------------------------- +# Test that if an SQLITE_BUSY is encountered within the vtable +# constructor, a relevant error message is returned. +# +do_multiclient_test tn { + do_test 1.$tn.1 { + sql1 { + CREATE TABLE t1(a, b); + INSERT INTO t1 VALUES(1,2); + CREATE VIRTUAL TABLE rt USING rtree(id, minx, maxx, miny, maxy); + INSERT INTO rt VALUES(1,2,3,4,5); + } + } {} + + do_test 1.$tn.2 { + sql2 { SELECT * FROM t1; } + } {1 2} + + do_test 1.$tn.3 { + sql1 { BEGIN EXCLUSIVE; INSERT INTO t1 VALUES(3, 4); } + } {} + + do_test 1.$tn.4 { + list [catch { sql2 { SELECT * FROM rt } } msg] $msg + } {1 {database is locked}} +} + +finish_test + + diff --git a/lib/libsqlite3/src/pragma.c b/lib/libsqlite3/src/pragma.c index a211633f231..fcecad269ab 100644 --- a/lib/libsqlite3/src/pragma.c +++ b/lib/libsqlite3/src/pragma.c @@ -824,7 +824,7 @@ void sqlite3Pragma( ** size of historical compatibility. */ case PragTyp_DEFAULT_CACHE_SIZE: { - static const int iLn = __LINE__+2; + static const int iLn = VDBE_OFFSET_LINENO(2); static const VdbeOpList getCacheSize[] = { { OP_Transaction, 0, 0, 0}, /* 0 */ { OP_ReadCookie, 0, 1, BTREE_DEFAULT_CACHE_SIZE}, /* 1 */ @@ -1087,7 +1087,7 @@ void sqlite3Pragma( ** file. Before writing to meta[6], check that meta[3] indicates ** that this really is an auto-vacuum capable database. */ - static const int iLn = __LINE__+2; + static const int iLn = VDBE_OFFSET_LINENO(2); static const VdbeOpList setMeta6[] = { { OP_Transaction, 0, 1, 0}, /* 0 */ { OP_ReadCookie, 0, 1, BTREE_LARGEST_ROOT_PAGE}, @@ -1790,7 +1790,7 @@ void sqlite3Pragma( ** messages have been generated, output OK. Otherwise output the ** error message */ - static const int iLn = __LINE__+2; + static const int iLn = VDBE_OFFSET_LINENO(2); static const VdbeOpList endCode[] = { { OP_AddImm, 1, 0, 0}, /* 0 */ { OP_IfNeg, 1, 0, 0}, /* 1 */ diff --git a/lib/libsqlite3/src/trigger.c b/lib/libsqlite3/src/trigger.c index dcbaf5d3321..01f7b21f74e 100644 --- a/lib/libsqlite3/src/trigger.c +++ b/lib/libsqlite3/src/trigger.c @@ -566,7 +566,7 @@ void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ assert( pTable!=0 ); if( (v = sqlite3GetVdbe(pParse))!=0 ){ int base; - static const int iLn = __LINE__+2; + static const int iLn = VDBE_OFFSET_LINENO(2); static const VdbeOpList dropTrigger[] = { { OP_Rewind, 0, ADDR(9), 0}, { OP_String8, 0, 1, 0}, /* 1 */ diff --git a/lib/libsqlite3/src/vdbe.h b/lib/libsqlite3/src/vdbe.h index 66ca602ab74..8e300b88a62 100644 --- a/lib/libsqlite3/src/vdbe.h +++ b/lib/libsqlite3/src/vdbe.h @@ -272,11 +272,13 @@ void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); # define VdbeCoverageIf(v,x) if(x)sqlite3VdbeSetLineNumber(v,__LINE__) # define VdbeCoverageAlwaysTaken(v) sqlite3VdbeSetLineNumber(v,2); # define VdbeCoverageNeverTaken(v) sqlite3VdbeSetLineNumber(v,1); +# define VDBE_OFFSET_LINENO(x) (__LINE__+x) #else # define VdbeCoverage(v) # define VdbeCoverageIf(v,x) # define VdbeCoverageAlwaysTaken(v) # define VdbeCoverageNeverTaken(v) +# define VDBE_OFFSET_LINENO(x) 0 #endif #endif diff --git a/lib/libsqlite3/src/vdbeaux.c b/lib/libsqlite3/src/vdbeaux.c index a641a72ec8e..96fd4016dad 100644 --- a/lib/libsqlite3/src/vdbeaux.c +++ b/lib/libsqlite3/src/vdbeaux.c @@ -3432,6 +3432,7 @@ int sqlite3VdbeRecordCompare( }else{ idx1 = getVarint32(aKey1, szHdr1); d1 = szHdr1; + if( d1>(unsigned)nKey1 ) return 1; /* Corruption */ i = 0; } diff --git a/lib/libsqlite3/src/vdbeblob.c b/lib/libsqlite3/src/vdbeblob.c index 4b34f2c2957..cf7495e5b4f 100644 --- a/lib/libsqlite3/src/vdbeblob.c +++ b/lib/libsqlite3/src/vdbeblob.c @@ -133,7 +133,7 @@ int sqlite3_blob_open( ** which closes the b-tree cursor and (possibly) commits the ** transaction. */ - static const int iLn = __LINE__+4; + static const int iLn = VDBE_OFFSET_LINENO(4); static const VdbeOpList openBlob[] = { /* {OP_Transaction, 0, 0, 0}, // 0: Inserted separately */ {OP_TableLock, 0, 0, 0}, /* 1: Acquire a read or write lock */ diff --git a/lib/libsqlite3/src/where.c b/lib/libsqlite3/src/where.c index 963878d0094..d8389a4d699 100644 --- a/lib/libsqlite3/src/where.c +++ b/lib/libsqlite3/src/where.c @@ -3974,7 +3974,10 @@ static int whereLoopAddBtreeIndex( pNew->aLTerm[pNew->nLTerm++] = 0; pNew->wsFlags |= WHERE_SKIPSCAN; nIter = sqlite3LogEst(pProbe->aiRowEst[0]/pProbe->aiRowEst[saved_nEq+1]); + pNew->rRun = rLogSize + nIter; + pNew->nOut += nIter; whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter); + pNew->nOut = saved_nOut; } for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){ int nIn = 0; @@ -5877,7 +5880,7 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ for(; k<last; k++, pOp++){ if( pOp->p1!=pLevel->iTabCur ) continue; if( pOp->opcode==OP_Column ){ - pOp->opcode = OP_SCopy; + pOp->opcode = OP_Copy; pOp->p1 = pOp->p2 + pTabItem->regResult; pOp->p2 = pOp->p3; pOp->p3 = 0; |