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

Protect all accesses to the FuncDef.u and Expr.u unions using nearby

assert()s or branches.

FossilOrigin-Name: 9af863f065e0bef491c2ab7525194505f9516f4e6dfc789d2e3a9d2c2438533a
This commit is contained in:
drh
2021-10-07 13:40:29 +00:00
parent 78b2fa8610
commit f975107437
19 changed files with 131 additions and 57 deletions

View File

@@ -4901,6 +4901,7 @@ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){
){
return eRet;
}
assert( !ExprHasProperty(pFunc, EP_IntValue) );
zFunc = pFunc->u.zToken;
if( sqlite3StrICmp(zFunc, "min")==0 ){
eRet = WHERE_ORDERBY_MIN;
@@ -6177,6 +6178,7 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
if( p->pGroupBy ) return 0;
pExpr = p->pEList->a[0].pExpr;
if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
assert( !ExprHasProperty(pExpr, EP_IntValue) );
if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */
if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */
if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */