1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00

bumped up SQLite to 3.25.3

This commit is contained in:
Kenichi Ishigaki 2018-12-01 11:46:22 +09:00
parent 3efc738102
commit 433a971b7e
3 changed files with 73 additions and 36 deletions

View file

@ -1028,7 +1028,7 @@ are limited by the typeless nature of the SQLite database.
=head1 SQLITE VERSION =head1 SQLITE VERSION
DBD::SQLite is usually compiled with a bundled SQLite library DBD::SQLite is usually compiled with a bundled SQLite library
(SQLite version S<3.25.2> as of this release) for consistency. (SQLite version S<3.25.3> as of this release) for consistency.
However, a different version of SQLite may sometimes be used for However, a different version of SQLite may sometimes be used for
some reasons like security, or some new experimental features. some reasons like security, or some new experimental features.

101
sqlite3.c
View file

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite ** This file is an amalgamation of many separate C source files from SQLite
** version 3.25.2. By combining all the individual C code files into this ** version 3.25.3. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation ** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be ** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements ** possible if the files were compiled separately. Performance improvements
@ -1156,9 +1156,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.25.2" #define SQLITE_VERSION "3.25.3"
#define SQLITE_VERSION_NUMBER 3025002 #define SQLITE_VERSION_NUMBER 3025003
#define SQLITE_SOURCE_ID "2018-09-25 19:08:10 fb90e7189ae6d62e77ba3a308ca5d683f90bbe633cf681865365b8e92792d1c7" #define SQLITE_SOURCE_ID "2018-11-05 20:37:38 89e099fbe5e13c33e683bef07361231ca525b88f7907be7092058007b75036f2"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -17912,6 +17912,7 @@ struct AuthContext {
*/ */
#define OPFLAG_NCHANGE 0x01 /* OP_Insert: Set to update db->nChange */ #define OPFLAG_NCHANGE 0x01 /* OP_Insert: Set to update db->nChange */
/* Also used in P2 (not P5) of OP_Delete */ /* Also used in P2 (not P5) of OP_Delete */
#define OPFLAG_NOCHNG 0x01 /* OP_VColumn nochange for UPDATE */
#define OPFLAG_EPHEM 0x01 /* OP_Column: Ephemeral output is ok */ #define OPFLAG_EPHEM 0x01 /* OP_Column: Ephemeral output is ok */
#define OPFLAG_LASTROWID 0x20 /* Set to update db->lastRowid */ #define OPFLAG_LASTROWID 0x20 /* Set to update db->lastRowid */
#define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */ #define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */
@ -80103,7 +80104,9 @@ SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
(void)getVarint32((u8*)m.z, szHdr); (void)getVarint32((u8*)m.z, szHdr);
testcase( szHdr==3 ); testcase( szHdr==3 );
testcase( szHdr==m.n ); testcase( szHdr==m.n );
if( unlikely(szHdr<3 || (int)szHdr>m.n) ){ testcase( szHdr>0x7fffffff );
assert( m.n>=0 );
if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){
goto idx_rowid_corruption; goto idx_rowid_corruption;
} }
@ -89616,10 +89619,11 @@ case OP_VFilter: { /* jump */
** **
** If the VColumn opcode is being used to fetch the value of ** If the VColumn opcode is being used to fetch the value of
** an unchanging column during an UPDATE operation, then the P5 ** an unchanging column during an UPDATE operation, then the P5
** value is 1. Otherwise, P5 is 0. The P5 value is returned ** value is OPFLAG_NOCHNG. This will cause the sqlite3_vtab_nochange()
** by sqlite3_vtab_nochange() routine and can be used ** function to return true inside the xColumn method of the virtual
** by virtual table implementations to return special "no-change" ** table implementation. The P5 column might also contain other
** marks which can be more efficient, depending on the virtual table. ** bits (OPFLAG_LENGTHARG or OPFLAG_TYPEOFARG) but those bits are
** unused by OP_VColumn.
*/ */
case OP_VColumn: { case OP_VColumn: {
sqlite3_vtab *pVtab; sqlite3_vtab *pVtab;
@ -89641,7 +89645,8 @@ case OP_VColumn: {
assert( pModule->xColumn ); assert( pModule->xColumn );
memset(&sContext, 0, sizeof(sContext)); memset(&sContext, 0, sizeof(sContext));
sContext.pOut = pDest; sContext.pOut = pDest;
if( pOp->p5 ){ testcase( (pOp->p5 & OPFLAG_NOCHNG)==0 && pOp->p5!=0 );
if( pOp->p5 & OPFLAG_NOCHNG ){
sqlite3VdbeMemSetNull(pDest); sqlite3VdbeMemSetNull(pDest);
pDest->flags = MEM_Null|MEM_Zero; pDest->flags = MEM_Null|MEM_Zero;
pDest->u.nZero = 0; pDest->u.nZero = 0;
@ -125441,6 +125446,13 @@ static void generateWithRecursiveQuery(
Expr *pLimit; /* Saved LIMIT and OFFSET */ Expr *pLimit; /* Saved LIMIT and OFFSET */
int regLimit, regOffset; /* Registers used by LIMIT and OFFSET */ int regLimit, regOffset; /* Registers used by LIMIT and OFFSET */
#ifndef SQLITE_OMIT_WINDOWFUNC
if( p->pWin ){
sqlite3ErrorMsg(pParse, "cannot use window functions in recursive queries");
return;
}
#endif
/* Obtain authorization to do a recursive query */ /* Obtain authorization to do a recursive query */
if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return; if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return;
@ -127190,7 +127202,7 @@ static int flattenSubquery(
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
/* /*
** A structure to keep track of all of the column values that fixed to ** A structure to keep track of all of the column values that are fixed to
** a known value due to WHERE clause constraints of the form COLUMN=VALUE. ** a known value due to WHERE clause constraints of the form COLUMN=VALUE.
*/ */
typedef struct WhereConst WhereConst; typedef struct WhereConst WhereConst;
@ -127202,13 +127214,28 @@ struct WhereConst {
}; };
/* /*
** Add a new entry to the pConst object ** Add a new entry to the pConst object. Except, do not add duplicate
** pColumn entires.
*/ */
static void constInsert( static void constInsert(
WhereConst *pConst, WhereConst *pConst, /* The WhereConst into which we are inserting */
Expr *pColumn, Expr *pColumn, /* The COLUMN part of the constraint */
Expr *pValue Expr *pValue /* The VALUE part of the constraint */
){ ){
int i;
assert( pColumn->op==TK_COLUMN );
/* 2018-10-25 ticket [cf5ed20f]
** Make sure the same pColumn is not inserted more than once */
for(i=0; i<pConst->nConst; i++){
const Expr *pExpr = pConst->apExpr[i*2];
assert( pExpr->op==TK_COLUMN );
if( pExpr->iTable==pColumn->iTable
&& pExpr->iColumn==pColumn->iColumn
){
return; /* Already present. Return without doing anything. */
}
}
pConst->nConst++; pConst->nConst++;
pConst->apExpr = sqlite3DbReallocOrFree(pConst->pParse->db, pConst->apExpr, pConst->apExpr = sqlite3DbReallocOrFree(pConst->pParse->db, pConst->apExpr,
@ -131974,7 +132001,7 @@ static void updateVirtualTable(
sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i); sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i);
}else{ }else{
sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i); sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i);
sqlite3VdbeChangeP5(v, 1); /* Enable sqlite3_vtab_nochange() */ sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG);/* Enable sqlite3_vtab_nochange() */
} }
} }
if( HasRowid(pTab) ){ if( HasRowid(pTab) ){
@ -134929,7 +134956,7 @@ static Expr *removeUnindexableInClauseTerms(
for(i=iEq; i<pLoop->nLTerm; i++){ for(i=iEq; i<pLoop->nLTerm; i++){
if( pLoop->aLTerm[i]->pExpr==pX ){ if( pLoop->aLTerm[i]->pExpr==pX ){
int iField = pLoop->aLTerm[i]->iField - 1; int iField = pLoop->aLTerm[i]->iField - 1;
assert( pOrigRhs->a[iField].pExpr!=0 ); if( pOrigRhs->a[iField].pExpr==0 ) continue; /* Duplicate PK column */
pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr); pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr);
pOrigRhs->a[iField].pExpr = 0; pOrigRhs->a[iField].pExpr = 0;
assert( pOrigLhs->a[iField].pExpr!=0 ); assert( pOrigLhs->a[iField].pExpr!=0 );
@ -138122,6 +138149,7 @@ static void exprAnalyze(
if( pExpr->op==TK_NOTNULL if( pExpr->op==TK_NOTNULL
&& pExpr->pLeft->op==TK_COLUMN && pExpr->pLeft->op==TK_COLUMN
&& pExpr->pLeft->iColumn>=0 && pExpr->pLeft->iColumn>=0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& OptimizationEnabled(db, SQLITE_Stat34) && OptimizationEnabled(db, SQLITE_Stat34)
){ ){
Expr *pNewExpr; Expr *pNewExpr;
@ -159161,7 +159189,7 @@ static int fts3ScanInteriorNode(
const char *zCsr = zNode; /* Cursor to iterate through node */ const char *zCsr = zNode; /* Cursor to iterate through node */
const char *zEnd = &zCsr[nNode];/* End of interior node buffer */ const char *zEnd = &zCsr[nNode];/* End of interior node buffer */
char *zBuffer = 0; /* Buffer to load terms into */ char *zBuffer = 0; /* Buffer to load terms into */
int nAlloc = 0; /* Size of allocated buffer */ i64 nAlloc = 0; /* Size of allocated buffer */
int isFirstTerm = 1; /* True when processing first term on page */ int isFirstTerm = 1; /* True when processing first term on page */
sqlite3_int64 iChild; /* Block id of child node to descend to */ sqlite3_int64 iChild; /* Block id of child node to descend to */
@ -159199,14 +159227,14 @@ static int fts3ScanInteriorNode(
zCsr += fts3GetVarint32(zCsr, &nSuffix); zCsr += fts3GetVarint32(zCsr, &nSuffix);
assert( nPrefix>=0 && nSuffix>=0 ); assert( nPrefix>=0 && nSuffix>=0 );
if( &zCsr[nSuffix]>zEnd ){ if( nPrefix>zCsr-zNode || nSuffix>zEnd-zCsr ){
rc = FTS_CORRUPT_VTAB; rc = FTS_CORRUPT_VTAB;
goto finish_scan; goto finish_scan;
} }
if( nPrefix+nSuffix>nAlloc ){ if( (i64)nPrefix+nSuffix>nAlloc ){
char *zNew; char *zNew;
nAlloc = (nPrefix+nSuffix) * 2; nAlloc = ((i64)nPrefix+nSuffix) * 2;
zNew = (char *)sqlite3_realloc(zBuffer, nAlloc); zNew = (char *)sqlite3_realloc64(zBuffer, nAlloc);
if( !zNew ){ if( !zNew ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM;
goto finish_scan; goto finish_scan;
@ -168788,15 +168816,19 @@ static int fts3SegReaderNext(
** safe (no risk of overread) even if the node data is corrupted. */ ** safe (no risk of overread) even if the node data is corrupted. */
pNext += fts3GetVarint32(pNext, &nPrefix); pNext += fts3GetVarint32(pNext, &nPrefix);
pNext += fts3GetVarint32(pNext, &nSuffix); pNext += fts3GetVarint32(pNext, &nSuffix);
if( nPrefix<0 || nSuffix<=0 if( nSuffix<=0
|| &pNext[nSuffix]>&pReader->aNode[pReader->nNode] || (&pReader->aNode[pReader->nNode] - pNext)<nSuffix
|| nPrefix>pReader->nTermAlloc
){ ){
return FTS_CORRUPT_VTAB; return FTS_CORRUPT_VTAB;
} }
if( nPrefix+nSuffix>pReader->nTermAlloc ){ /* Both nPrefix and nSuffix were read by fts3GetVarint32() and so are
int nNew = (nPrefix+nSuffix)*2; ** between 0 and 0x7FFFFFFF. But the sum of the two may cause integer
char *zNew = sqlite3_realloc(pReader->zTerm, nNew); ** overflow - hence the (i64) casts. */
if( (i64)nPrefix+nSuffix>(i64)pReader->nTermAlloc ){
i64 nNew = ((i64)nPrefix+nSuffix)*2;
char *zNew = sqlite3_realloc64(pReader->zTerm, nNew);
if( !zNew ){ if( !zNew ){
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
@ -168818,7 +168850,7 @@ static int fts3SegReaderNext(
** b-tree node. And that the final byte of the doclist is 0x00. If either ** b-tree node. And that the final byte of the doclist is 0x00. If either
** of these statements is untrue, then the data structure is corrupt. ** of these statements is untrue, then the data structure is corrupt.
*/ */
if( &pReader->aDoclist[pReader->nDoclist]>&pReader->aNode[pReader->nNode] if( (&pReader->aNode[pReader->nNode] - pReader->aDoclist)<pReader->nDoclist
|| (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1]) || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])
){ ){
return FTS_CORRUPT_VTAB; return FTS_CORRUPT_VTAB;
@ -171144,6 +171176,9 @@ static int nodeReaderNext(NodeReader *p){
} }
p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix); p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix);
if( nPrefix>p->iOff || nSuffix>p->nNode-p->iOff ){
return SQLITE_CORRUPT_VTAB;
}
blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc); blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix); memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix);
@ -171151,6 +171186,9 @@ static int nodeReaderNext(NodeReader *p){
p->iOff += nSuffix; p->iOff += nSuffix;
if( p->iChild==0 ){ if( p->iChild==0 ){
p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &p->nDoclist); p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &p->nDoclist);
if( (p->nNode-p->iOff)<p->nDoclist ){
return SQLITE_CORRUPT_VTAB;
}
p->aDoclist = &p->aNode[p->iOff]; p->aDoclist = &p->aNode[p->iOff];
p->iOff += p->nDoclist; p->iOff += p->nDoclist;
} }
@ -171158,7 +171196,6 @@ static int nodeReaderNext(NodeReader *p){
} }
assert( p->iOff<=p->nNode ); assert( p->iOff<=p->nNode );
return rc; return rc;
} }
@ -214444,7 +214481,7 @@ static void fts5SourceIdFunc(
){ ){
assert( nArg==0 ); assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused); UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2018-09-25 19:08:10 fb90e7189ae6d62e77ba3a308ca5d683f90bbe633cf681865365b8e92792d1c7", -1, SQLITE_TRANSIENT); sqlite3_result_text(pCtx, "fts5: 2018-11-05 20:37:38 89e099fbe5e13c33e683bef07361231ca525b88f7907be7092058007b75036f2", -1, SQLITE_TRANSIENT);
} }
static int fts5Init(sqlite3 *db){ static int fts5Init(sqlite3 *db){
@ -219154,9 +219191,9 @@ SQLITE_API int sqlite3_stmt_init(
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
/************** End of stmt.c ************************************************/ /************** End of stmt.c ************************************************/
#if __LINE__!=219157 #if __LINE__!=219194
#undef SQLITE_SOURCE_ID #undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID "2018-09-25 19:08:10 fb90e7189ae6d62e77ba3a308ca5d683f90bbe633cf681865365b8e92792alt2" #define SQLITE_SOURCE_ID "2018-11-05 20:37:38 89e099fbe5e13c33e683bef07361231ca525b88f7907be7092058007b750alt2"
#endif #endif
/* Return the source-id for this library */ /* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }

View file

@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.25.2" #define SQLITE_VERSION "3.25.3"
#define SQLITE_VERSION_NUMBER 3025002 #define SQLITE_VERSION_NUMBER 3025003
#define SQLITE_SOURCE_ID "2018-09-25 19:08:10 fb90e7189ae6d62e77ba3a308ca5d683f90bbe633cf681865365b8e92792d1c7" #define SQLITE_SOURCE_ID "2018-11-05 20:37:38 89e099fbe5e13c33e683bef07361231ca525b88f7907be7092058007b75036f2"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers