/ Check-in [8e818b89]
Login

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

Overview
Comment:Return an error message (instead of segfaulting) if test function fts5_expr() is invoked with no arguments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8e818b8985c0196cd9671a6491796faaeebeb16e
User & Date: dan 2015-07-30 11:26:10
Context
2015-07-30
11:38
Allow RBU tables to be named "data[0-9]*_<target>" instead of strictly "data_<target>". Also update RBU so that it always processes data tables in order sorted by name. check-in: 287aa306 user: dan tags: trunk
11:26
Return an error message (instead of segfaulting) if test function fts5_expr() is invoked with no arguments. check-in: 8e818b89 user: dan tags: trunk
2015-07-29
22:38
Support building VSIX packages for UAP using Visual Studio 2015 and the Windows 10 SDK. check-in: 96559adb user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_expr.c.

  1860   1860     int i;
  1861   1861   
  1862   1862     const char **azConfig;          /* Array of arguments for Fts5Config */
  1863   1863     const char *zNearsetCmd = "nearset";
  1864   1864     int nConfig;                    /* Size of azConfig[] */
  1865   1865     Fts5Config *pConfig = 0;
  1866   1866     int iArg = 1;
         1867  +
         1868  +  if( nArg<1 ){
         1869  +    char *zErr = sqlite3_mprintf("wrong number of arguments to function %s",
         1870  +        bTcl ? "fts5_expr_tcl" : "fts5_expr"
         1871  +    );
         1872  +    sqlite3_result_error(pCtx, zErr, -1);
         1873  +    sqlite3_free(zErr);
         1874  +    return;
         1875  +  }
  1867   1876   
  1868   1877     if( bTcl && nArg>1 ){
  1869   1878       zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]);
  1870   1879       iArg = 2;
  1871   1880     }
  1872   1881   
  1873   1882     nConfig = 3 + (nArg-iArg);

Changes to ext/fts5/test/fts5eb.test.

    42     42     10 {abc + . + def}                 {"abc" + "def"}
    43     43     11 {abc . def}                     {"abc" AND "def"}
    44     44     12 {r+e OR w}                      {"r" + "e" OR "w"}
    45     45   } {
    46     46     do_execsql_test 1.$tn {SELECT fts5_expr($expr)} [list $res]
    47     47   }
    48     48   
           49  +do_catchsql_test 2.1 {
           50  +  SELECT fts5_expr()
           51  +} {1 {wrong number of arguments to function fts5_expr}}
           52  +
           53  +do_catchsql_test 2.1 {
           54  +  SELECT fts5_expr_tcl()
           55  +} {1 {wrong number of arguments to function fts5_expr_tcl}}
    49     56   
    50     57   finish_test
    51     58   
    52     59   
    53     60