/ Check-in [8f21d778]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Simplification to the logic that detects misuse of the application-defined function creation interfaces.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8f21d778450e1e5d2bc7f109d614fe018eb3d228b0bfc91cd3c6a5204415998f
User & Date: drh 2018-07-09 02:37:12
Context
2018-07-09
06:51
Fix a bad assert() in window.c. check-in: fe8aaf0c user: dan tags: trunk
02:37
Simplification to the logic that detects misuse of the application-defined function creation interfaces. check-in: 8f21d778 user: drh tags: trunk
02:02
During WITHOUT ROWID table creation, if the sqlite3CreateTable() call fails due to an authorizer denying the INSERT into the sqlite_master table, then detect this fact and abort the CREATE TABLE early, to avoid an assertion fault. check-in: 164b1641 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

  1688   1688     FuncDestructor *pDestructor
  1689   1689   ){
  1690   1690     FuncDef *p;
  1691   1691     int nName;
  1692   1692     int extraFlags;
  1693   1693   
  1694   1694     assert( sqlite3_mutex_held(db->mutex) );
  1695         -  if( zFunctionName==0 ||
  1696         -      (xSFunc && (xFinal || xStep)) || 
  1697         -      (!xSFunc && (xFinal && !xStep)) ||
  1698         -      (!xSFunc && (!xFinal && xStep)) ||
  1699         -      ((xValue || xInverse) && (!xStep || !xFinal || !xValue || !xInverse)) ||
  1700         -      (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) ||
  1701         -      (255<(nName = sqlite3Strlen30( zFunctionName))) ){
         1695  +  assert( xValue==0 || xSFunc==0 );
         1696  +  if( zFunctionName==0                /* Must have a valid name */
         1697  +   || (xSFunc!=0 && xFinal!=0)        /* Not both xSFunc and xFinal */
         1698  +   || ((xFinal==0)!=(xStep==0))       /* Both or neither of xFinal and xStep */
         1699  +   || ((xValue==0)!=(xInverse==0))    /* Both or neither of xValue, xInverse */
         1700  +   || (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG)
         1701  +   || (255<(nName = sqlite3Strlen30( zFunctionName)))
         1702  +  ){
  1702   1703       return SQLITE_MISUSE_BKPT;
  1703   1704     }
  1704   1705   
  1705   1706     assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC );
  1706   1707     extraFlags = enc &  SQLITE_DETERMINISTIC;
  1707   1708     enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY);
  1708   1709