1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Fix a segfault caused by having identical window functions in the select-list

and ORDER BY clause of a SELECT statement.

FossilOrigin-Name: 693b4350d741391226a33ab6a05eaad61e8ef1590176f01e8aed2a212e2d6419
This commit is contained in:
dan
2018-07-02 17:14:37 +00:00
parent 6b4b88208e
commit f607bec749
4 changed files with 40 additions and 9 deletions

View File

@@ -1243,6 +1243,17 @@ static int resolveOrderGroupBy(
}
for(j=0; j<pSelect->pEList->nExpr; j++){
if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
#ifndef SQLITE_OMIT_WINDOWFUNC
if( pE->pWin ){
Window **pp;
for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
if( *pp==pE->pWin ){
*pp = (*pp)->pNextWin;
break;
}
}
}
#endif
pItem->u.x.iOrderByCol = j+1;
}
}