1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Simplification to the logic that detects misuse of the application-defined

function creation interfaces.

FossilOrigin-Name: 8f21d778450e1e5d2bc7f109d614fe018eb3d228b0bfc91cd3c6a5204415998f
This commit is contained in:
drh
2018-07-09 02:37:12 +00:00
parent 8ff21f47f0
commit 1e80ace47a
3 changed files with 15 additions and 14 deletions

View File

@@ -1692,13 +1692,14 @@ int sqlite3CreateFunc(
int extraFlags;
assert( sqlite3_mutex_held(db->mutex) );
if( zFunctionName==0 ||
(xSFunc && (xFinal || xStep)) ||
(!xSFunc && (xFinal && !xStep)) ||
(!xSFunc && (!xFinal && xStep)) ||
((xValue || xInverse) && (!xStep || !xFinal || !xValue || !xInverse)) ||
(nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) ||
(255<(nName = sqlite3Strlen30( zFunctionName))) ){
assert( xValue==0 || xSFunc==0 );
if( zFunctionName==0 /* Must have a valid name */
|| (xSFunc!=0 && xFinal!=0) /* Not both xSFunc and xFinal */
|| ((xFinal==0)!=(xStep==0)) /* Both or neither of xFinal and xStep */
|| ((xValue==0)!=(xInverse==0)) /* Both or neither of xValue, xInverse */
|| (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG)
|| (255<(nName = sqlite3Strlen30( zFunctionName)))
){
return SQLITE_MISUSE_BKPT;
}