MFV r362143:

Update sqlite3 to 3.32.2 (3320200).

CVE-2020-11655: SQLite through 3.31.1 allows attackers to cause a denial of
service (segmentation fault) via a malformed window-function query because
the AggInfo object's initialization is mishandled.

CVE-2020-13434: SQLite through 3.32.0 has an integer overflow in
sqlite3_str_vappendf in printf.c.

CVE-2020-13435: SQLite through 3.32.0 has a segmentation fault in
sqlite3ExprCodeTarget in expr.c.

CVE-2020-13630: ext/fts3/fts3.c in SQLite before 3.32.0 has a
use-after-free in fts3EvalNextRow, related to the snippet feature

CVE-2020-13631: SQLite before 3.32.0 allows a virtual table to be renamed
to the name of one of its shadow tables, related to alter.c and build.c.

CVE-2020-13632: ext/fts3/fts3_snippet.c in SQLite before 3.32.0 ha s a
NULL pointer dereference via a crafted matchinfo() query.

PR:		247149
Reported by:	spam123@bitbert.com
MFC after:	3 days
Security:	vuxml: c4ac9c79-ab37-11ea-8b5e-b42e99a1b9c3
		https://nvd.nist.gov/vuln/detail/CVE-2020-11655
		https://nvd.nist.gov/vuln/detail/CVE-2020-13434
		https://nvd.nist.gov/vuln/detail/CVE-2020-13435
		https://nvd.nist.gov/vuln/detail/CVE-2020-13630
		https://nvd.nist.gov/vuln/detail/CVE-2020-13631
		https://nvd.nist.gov/vuln/detail/CVE-2020-13632
This commit is contained in:
Cy Schubert 2020-06-13 04:47:59 +00:00
commit 9236bd4bb7
7 changed files with 134 additions and 75 deletions

View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for sqlite 3.32.0. # Generated by GNU Autoconf 2.69 for sqlite 3.32.2.
# #
# Report bugs to <http://www.sqlite.org>. # Report bugs to <http://www.sqlite.org>.
# #
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='sqlite' PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite' PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.32.0' PACKAGE_VERSION='3.32.2'
PACKAGE_STRING='sqlite 3.32.0' PACKAGE_STRING='sqlite 3.32.2'
PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_BUGREPORT='http://www.sqlite.org'
PACKAGE_URL='' PACKAGE_URL=''
@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures sqlite 3.32.0 to adapt to many kinds of systems. \`configure' configures sqlite 3.32.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1412,7 +1412,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.32.0:";; short | recursive ) echo "Configuration of sqlite 3.32.2:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1537,7 +1537,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
sqlite configure 3.32.0 sqlite configure 3.32.2
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.32.0, which was It was created by sqlite $as_me 3.32.2, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -2818,7 +2818,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='sqlite' PACKAGE='sqlite'
VERSION='3.32.0' VERSION='3.32.2'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by sqlite $as_me 3.32.0, which was This file was extended by sqlite $as_me 3.32.2, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -14495,7 +14495,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
sqlite config.status 3.32.0 sqlite config.status 3.32.2
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -10,7 +10,7 @@
# #
AC_PREREQ(2.61) AC_PREREQ(2.61)
AC_INIT(sqlite, 3.32.0, http://www.sqlite.org) AC_INIT(sqlite, 3.32.2, http://www.sqlite.org)
AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_SRCDIR([sqlite3.c])
AC_CONFIG_AUX_DIR([.]) AC_CONFIG_AUX_DIR([.])

View File

@ -6591,6 +6591,7 @@ int sqlite3_zipfile_init(
/* #include "sqlite3ext.h" */ /* #include "sqlite3ext.h" */
SQLITE_EXTENSION_INIT1 SQLITE_EXTENSION_INIT1
#include <zlib.h> #include <zlib.h>
#include <assert.h>
/* /*
** Implementation of the "sqlar_compress(X)" SQL function. ** Implementation of the "sqlar_compress(X)" SQL function.

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.32.0. By combining all the individual C code files into this ** version 3.32.2. 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
@ -1162,9 +1162,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.32.0" #define SQLITE_VERSION "3.32.2"
#define SQLITE_VERSION_NUMBER 3032000 #define SQLITE_VERSION_NUMBER 3032002
#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a" #define SQLITE_SOURCE_ID "2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e86861e8c"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -17843,7 +17843,7 @@ struct Token {
** code for a SELECT that contains aggregate functions. ** code for a SELECT that contains aggregate functions.
** **
** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a ** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
** pointer to this structure. The Expr.iColumn field is the index in ** pointer to this structure. The Expr.iAgg field is the index in
** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate ** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
** code for that node. ** code for that node.
** **
@ -19082,6 +19082,9 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*);
SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*); SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*);
SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*); SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*);
SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*); SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*);
SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker*,Select*);
SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker*,Select*);
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*); SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*);
#endif #endif
@ -28276,6 +28279,13 @@ static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){
#endif #endif
#define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */ #define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */
/*
** Hard limit on the precision of floating-point conversions.
*/
#ifndef SQLITE_PRINTF_PRECISION_LIMIT
# define SQLITE_FP_PRECISION_LIMIT 100000000
#endif
/* /*
** Render a string given by "fmt" into the StrAccum object. ** Render a string given by "fmt" into the StrAccum object.
*/ */
@ -28476,6 +28486,8 @@ SQLITE_API void sqlite3_str_vappendf(
** xtype The class of the conversion. ** xtype The class of the conversion.
** infop Pointer to the appropriate info struct. ** infop Pointer to the appropriate info struct.
*/ */
assert( width>=0 );
assert( precision>=(-1) );
switch( xtype ){ switch( xtype ){
case etPOINTER: case etPOINTER:
flag_long = sizeof(char*)==sizeof(i64) ? 2 : flag_long = sizeof(char*)==sizeof(i64) ? 2 :
@ -28597,6 +28609,11 @@ SQLITE_API void sqlite3_str_vappendf(
length = 0; length = 0;
#else #else
if( precision<0 ) precision = 6; /* Set default precision */ if( precision<0 ) precision = 6; /* Set default precision */
#ifdef SQLITE_FP_PRECISION_LIMIT
if( precision>SQLITE_FP_PRECISION_LIMIT ){
precision = SQLITE_FP_PRECISION_LIMIT;
}
#endif
if( realvalue<0.0 ){ if( realvalue<0.0 ){
realvalue = -realvalue; realvalue = -realvalue;
prefix = '-'; prefix = '-';
@ -28879,7 +28896,7 @@ SQLITE_API void sqlite3_str_vappendf(
} }
isnull = escarg==0; isnull = escarg==0;
if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
/* For %q, %Q, and %w, the precision is the number of byte (or /* For %q, %Q, and %w, the precision is the number of bytes (or
** characters if the ! flags is present) to use from the input. ** characters if the ! flags is present) to use from the input.
** Because of the extra quoting characters inserted, the number ** Because of the extra quoting characters inserted, the number
** of output characters may be larger than the precision. ** of output characters may be larger than the precision.
@ -29964,8 +29981,9 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m
#endif #endif
} }
if( pExpr->op==TK_AGG_FUNCTION ){ if( pExpr->op==TK_AGG_FUNCTION ){
sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s", sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s iAgg=%d agg=%p",
pExpr->op2, pExpr->u.zToken, zFlgs); pExpr->op2, pExpr->u.zToken, zFlgs,
pExpr->iAgg, pExpr->pAggInfo);
}else if( pExpr->op2!=0 ){ }else if( pExpr->op2!=0 ){
const char *zOp2; const char *zOp2;
char zBuf[8]; char zBuf[8];
@ -62135,12 +62153,14 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){
SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){ SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
int rc; /* Return code */ int rc; /* Return code */
int cnt = 0; /* Number of TryBeginRead attempts */ int cnt = 0; /* Number of TryBeginRead attempts */
#ifdef SQLITE_ENABLE_SNAPSHOT
int bChanged = 0;
WalIndexHdr *pSnapshot = pWal->pSnapshot;
#endif
assert( pWal->ckptLock==0 ); assert( pWal->ckptLock==0 );
#ifdef SQLITE_ENABLE_SNAPSHOT #ifdef SQLITE_ENABLE_SNAPSHOT
int bChanged = 0;
WalIndexHdr *pSnapshot = pWal->pSnapshot;
if( pSnapshot ){ if( pSnapshot ){
if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){ if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
bChanged = 1; bChanged = 1;
@ -85800,6 +85820,8 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
goto no_mem; goto no_mem;
} }
assert( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_BUSY ); assert( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_BUSY );
testcase( p->rc!=SQLITE_OK );
p->rc = SQLITE_OK;
assert( p->bIsReader || p->readOnly!=0 ); assert( p->bIsReader || p->readOnly!=0 );
p->iCurrentTime = 0; p->iCurrentTime = 0;
assert( p->explain==0 ); assert( p->explain==0 );
@ -97465,6 +97487,43 @@ SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){
return WRC_Continue; return WRC_Continue;
} }
/* Increase the walkerDepth when entering a subquery, and
** descrease when leaving the subquery.
*/
SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker *pWalker, Select *pSelect){
UNUSED_PARAMETER(pSelect);
pWalker->walkerDepth++;
return WRC_Continue;
}
SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker *pWalker, Select *pSelect){
UNUSED_PARAMETER(pSelect);
pWalker->walkerDepth--;
}
/*
** No-op routine for the parse-tree walker.
**
** When this routine is the Walker.xExprCallback then expression trees
** are walked without any actions being taken at each node. Presumably,
** when this routine is used for Walker.xExprCallback then
** Walker.xSelectCallback is set to do something useful for every
** subquery in the parser tree.
*/
SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
UNUSED_PARAMETER2(NotUsed, NotUsed2);
return WRC_Continue;
}
/*
** No-op routine for the parse-tree walker for SELECT statements.
** subquery in the parser tree.
*/
SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){
UNUSED_PARAMETER2(NotUsed, NotUsed2);
return WRC_Continue;
}
/************** End of walker.c **********************************************/ /************** End of walker.c **********************************************/
/************** Begin file resolve.c *****************************************/ /************** Begin file resolve.c *****************************************/
/* /*
@ -97493,6 +97552,8 @@ SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){
** **
** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..) ** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
** is a helper function - a callback for the tree walker. ** is a helper function - a callback for the tree walker.
**
** See also the sqlite3WindowExtraAggFuncDepth() routine in window.c
*/ */
static int incrAggDepth(Walker *pWalker, Expr *pExpr){ static int incrAggDepth(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n; if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
@ -103234,7 +103295,10 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
switch( op ){ switch( op ){
case TK_AGG_COLUMN: { case TK_AGG_COLUMN: {
AggInfo *pAggInfo = pExpr->pAggInfo; AggInfo *pAggInfo = pExpr->pAggInfo;
struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg]; struct AggInfo_col *pCol;
assert( pAggInfo!=0 );
assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
pCol = &pAggInfo->aCol[pExpr->iAgg];
if( !pAggInfo->directMode ){ if( !pAggInfo->directMode ){
assert( pCol->iMem>0 ); assert( pCol->iMem>0 );
return pCol->iMem; return pCol->iMem;
@ -103534,7 +103598,10 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
} }
case TK_AGG_FUNCTION: { case TK_AGG_FUNCTION: {
AggInfo *pInfo = pExpr->pAggInfo; AggInfo *pInfo = pExpr->pAggInfo;
if( pInfo==0 ){ if( pInfo==0
|| NEVER(pExpr->iAgg<0)
|| NEVER(pExpr->iAgg>=pInfo->nFunc)
){
assert( !ExprHasProperty(pExpr, EP_IntValue) ); assert( !ExprHasProperty(pExpr, EP_IntValue) );
sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
}else{ }else{
@ -105290,15 +105357,6 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
} }
return WRC_Continue; return WRC_Continue;
} }
static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
UNUSED_PARAMETER(pSelect);
pWalker->walkerDepth++;
return WRC_Continue;
}
static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){
UNUSED_PARAMETER(pSelect);
pWalker->walkerDepth--;
}
/* /*
** Analyze the pExpr expression looking for aggregate functions and ** Analyze the pExpr expression looking for aggregate functions and
@ -105312,8 +105370,8 @@ static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){ SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
Walker w; Walker w;
w.xExprCallback = analyzeAggregate; w.xExprCallback = analyzeAggregate;
w.xSelectCallback = analyzeAggregatesInSelect; w.xSelectCallback = sqlite3WalkerDepthIncrease;
w.xSelectCallback2 = analyzeAggregatesInSelectEnd; w.xSelectCallback2 = sqlite3WalkerDepthDecrease;
w.walkerDepth = 0; w.walkerDepth = 0;
w.u.pNC = pNC; w.u.pNC = pNC;
w.pParse = 0; w.pParse = 0;
@ -122035,7 +122093,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
sqlite3TableAffinity(v, pTab, regNewData+1); sqlite3TableAffinity(v, pTab, regNewData+1);
bAffinityDone = 1; bAffinityDone = 1;
} }
VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName)); VdbeNoopComment((v, "prep index %s", pIdx->zName));
iThisCur = iIdxCur+ix; iThisCur = iIdxCur+ix;
@ -134007,29 +134065,6 @@ static int selectExpander(Walker *pWalker, Select *p){
return WRC_Continue; return WRC_Continue;
} }
/*
** No-op routine for the parse-tree walker.
**
** When this routine is the Walker.xExprCallback then expression trees
** are walked without any actions being taken at each node. Presumably,
** when this routine is used for Walker.xExprCallback then
** Walker.xSelectCallback is set to do something useful for every
** subquery in the parser tree.
*/
SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
UNUSED_PARAMETER2(NotUsed, NotUsed2);
return WRC_Continue;
}
/*
** No-op routine for the parse-tree walker for SELECT statements.
** subquery in the parser tree.
*/
SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){
UNUSED_PARAMETER2(NotUsed, NotUsed2);
return WRC_Continue;
}
#if SQLITE_DEBUG #if SQLITE_DEBUG
/* /*
** Always assert. This xSelectCallback2 implementation proves that the ** Always assert. This xSelectCallback2 implementation proves that the
@ -135200,7 +135235,7 @@ SQLITE_PRIVATE int sqlite3Select(
#if SELECTTRACE_ENABLED #if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x400 ){ if( sqlite3SelectTrace & 0x400 ){
int ii; int ii;
SELECTTRACE(0x400,pParse,p,("After aggregate analysis:\n")); SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", &sAggInfo));
sqlite3TreeViewSelect(0, p, 0); sqlite3TreeViewSelect(0, p, 0);
for(ii=0; ii<sAggInfo.nColumn; ii++){ for(ii=0; ii<sAggInfo.nColumn; ii++){
sqlite3DebugPrintf("agg-column[%d] iMem=%d\n", sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
@ -151244,6 +151279,23 @@ static ExprList *exprListAppendList(
return pList; return pList;
} }
/*
** When rewriting a query, if the new subquery in the FROM clause
** contains TK_AGG_FUNCTION nodes that refer to an outer query,
** then we have to increase the Expr->op2 values of those nodes
** due to the extra subquery layer that was added.
**
** See also the incrAggDepth() routine in resolve.c
*/
static int sqlite3WindowExtraAggFuncDepth(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_AGG_FUNCTION
&& pExpr->op2>=pWalker->walkerDepth
){
pExpr->op2++;
}
return WRC_Continue;
}
/* /*
** If the SELECT statement passed as the second argument does not invoke ** If the SELECT statement passed as the second argument does not invoke
** any SQL window functions, this function is a no-op. Otherwise, it ** any SQL window functions, this function is a no-op. Otherwise, it
@ -151353,6 +151405,7 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){
p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
if( p->pSrc ){ if( p->pSrc ){
Table *pTab2; Table *pTab2;
Walker w;
p->pSrc->a[0].pSelect = pSub; p->pSrc->a[0].pSelect = pSub;
sqlite3SrcListAssignCursors(pParse, p->pSrc); sqlite3SrcListAssignCursors(pParse, p->pSrc);
pSub->selFlags |= SF_Expanded; pSub->selFlags |= SF_Expanded;
@ -151368,6 +151421,11 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){
pTab->tabFlags |= TF_Ephemeral; pTab->tabFlags |= TF_Ephemeral;
p->pSrc->a[0].pTab = pTab; p->pSrc->a[0].pTab = pTab;
pTab = pTab2; pTab = pTab2;
memset(&w, 0, sizeof(w));
w.xExprCallback = sqlite3WindowExtraAggFuncDepth;
w.xSelectCallback = sqlite3WalkerDepthIncrease;
w.xSelectCallback2 = sqlite3WalkerDepthDecrease;
sqlite3WalkSelect(&w, pSub);
} }
}else{ }else{
sqlite3SelectDelete(db, pSub); sqlite3SelectDelete(db, pSub);
@ -224766,7 +224824,7 @@ static void fts5SourceIdFunc(
){ ){
assert( nArg==0 ); assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused); UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a", -1, SQLITE_TRANSIENT); sqlite3_result_text(pCtx, "fts5: 2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e86861e8c", -1, SQLITE_TRANSIENT);
} }
/* /*
@ -229549,9 +229607,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__!=229552 #if __LINE__!=229610
#undef SQLITE_SOURCE_ID #undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360falt2" #define SQLITE_SOURCE_ID "2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e8686alt2"
#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.32.0" #define SQLITE_VERSION "3.32.2"
#define SQLITE_VERSION_NUMBER 3032000 #define SQLITE_VERSION_NUMBER 3032002
#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a" #define SQLITE_SOURCE_ID "2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e86861e8c"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers

View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for sqlite 3.32.0. # Generated by GNU Autoconf 2.69 for sqlite 3.32.2.
# #
# #
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='sqlite' PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite' PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.32.0' PACKAGE_VERSION='3.32.2'
PACKAGE_STRING='sqlite 3.32.0' PACKAGE_STRING='sqlite 3.32.2'
PACKAGE_BUGREPORT='' PACKAGE_BUGREPORT=''
PACKAGE_URL='' PACKAGE_URL=''
@ -1303,7 +1303,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures sqlite 3.32.0 to adapt to many kinds of systems. \`configure' configures sqlite 3.32.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1365,7 +1365,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.32.0:";; short | recursive ) echo "Configuration of sqlite 3.32.2:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1467,7 +1467,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
sqlite configure 3.32.0 sqlite configure 3.32.2
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -1878,7 +1878,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.32.0, which was It was created by sqlite $as_me 3.32.2, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -9373,7 +9373,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by sqlite $as_me 3.32.0, which was This file was extended by sqlite $as_me 3.32.2, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -9426,7 +9426,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
sqlite config.status 3.32.0 sqlite config.status 3.32.2
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -19,7 +19,7 @@ dnl to configure the system for the local environment.
# so you can encode the package version directly into the source files. # so you can encode the package version directly into the source files.
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
AC_INIT([sqlite], [3.32.0]) AC_INIT([sqlite], [3.32.2])
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars. # Call TEA_INIT as the first TEA_ macro to set up initial vars.