aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <>2023-10-19 12:12:49 +0000
committerdrh <>2023-10-19 12:12:49 +0000
commit519017f25ae6d8189bc04dd815a987ec4967a8ea (patch)
treef518e594fb0e0f0ba2a62c70b024ecad1628c718 /src/expr.c
parentd9451051f1f0e7263db0907da78d07b0f69cdbee (diff)
downloadsqlite-519017f25ae6d8189bc04dd815a987ec4967a8ea.tar.gz
sqlite-519017f25ae6d8189bc04dd815a987ec4967a8ea.zip
Fix the sqlite3ReferencesSrcList() routine so that it recognizes columns
in the ORDER BY clause of an aggregate. Fixes a problem with [634286828dad873d] discoverd by dbsqlfuzz. FossilOrigin-Name: 3d26f1aaa4876f21f2c3abf13bbc37933c8f32471153e29019880cc9530cb011
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c
index 08d5ae36e..38da1ab69 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -6466,6 +6466,12 @@ int sqlite3ReferencesSrcList(Parse *pParse, Expr *pExpr, SrcList *pSrcList){
assert( pExpr->op==TK_AGG_FUNCTION );
assert( ExprUseXList(pExpr) );
sqlite3WalkExprList(&w, pExpr->x.pList);
+ if( pExpr->pLeft ){
+ assert( pExpr->pLeft->op==TK_ORDER );
+ assert( ExprUseXList(pExpr->pLeft) );
+ assert( pExpr->pLeft->x.pList!=0 );
+ sqlite3WalkExprList(&w, pExpr->pLeft->x.pList);
+ }
#ifndef SQLITE_OMIT_WINDOWFUNC
if( ExprHasProperty(pExpr, EP_WinFunc) ){
sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter);