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:
15
src/main.c
15
src/main.c
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user