diff options
author | drh <drh@noemail.net> | 2020-01-08 17:28:19 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-01-08 17:28:19 +0000 |
commit | 0dfa5255bc012a1991809e23ad2ac1a4089e1261 (patch) | |
tree | c5c6a902e0f9332547c9b20f4a54c8dd7c0ee5b2 /src/resolve.c | |
parent | 15f3eacfc0e9cfe6ebd4e71a342fab18c6d5eee0 (diff) | |
download | sqlite-0dfa5255bc012a1991809e23ad2ac1a4089e1261.tar.gz sqlite-0dfa5255bc012a1991809e23ad2ac1a4089e1261.zip |
Check for whether or not it is safe to use non-innocuous functions as the
function is being coded, not when its name is resolved.
FossilOrigin-Name: 1da802d54b689a462e1fe899c6ffa08ef14d34f36728b14b055b5a76b1edc274
Diffstat (limited to 'src/resolve.c')
-rw-r--r-- | src/resolve.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/resolve.c b/src/resolve.c index 929c8743f..16546ada4 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -876,33 +876,18 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ }else{ assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */ pExpr->op2 = pNC->ncFlags & NC_SelfRef; + if( pExpr->op2 ) ExprSetProperty(pExpr, EP_FromDDL); } if( (pDef->funcFlags & SQLITE_FUNC_INTERNAL)!=0 && pParse->nested==0 && (pParse->db->mDbFlags & DBFLAG_InternalFunc)==0 ){ /* Internal-use-only functions are disallowed unless the - ** SQL is being compiled using sqlite3NestedParse() */ + ** SQL is being compiled using sqlite3NestedParse() or + ** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be + ** used to activate internal functionsn for testing purposes */ no_such_func = 1; pDef = 0; - }else - if( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 - && ExprHasProperty(pExpr, EP_FromDDL) - && !IN_RENAME_OBJECT - ){ - if( (pDef->funcFlags & SQLITE_FUNC_DIRECT)!=0 - || (pParse->db->flags & SQLITE_TrustedSchema)==0 - ){ - /* Functions prohibited in triggers and views if: - ** (1) tagged with SQLITE_DIRECTONLY - ** (2) not tagged with SQLITE_INNOCUOUS (which means it - ** is tagged with SQLITE_FUNC_UNSAFE) and - ** SQLITE_DBCONFIG_UNTRUSTED_SCHEMA is off (meaning - ** that the schema is fully trustworthy). - */ - sqlite3ErrorMsg(pParse, "%s() prohibited in triggers and views", - pDef->zName); - } } } |