/ Check-in [54b8968e]
Login

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

Overview
Comment:Fix a memory leak in fts5 that could occur following a syntax error in a query expression.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 54b8968e335760105206b894672213c1d56771a4
User & Date: dan 2016-03-14 12:16:23
Context
2016-03-14
15:03
Run TCL tests in the "testdir" subdirectory. check-in: 90e0cc7b user: drh tags: trunk
13:42
Run TCL tests in a subdirectory "testdir". check-in: f632bba0 user: drh tags: test-in-subdir
12:16
Fix a memory leak in fts5 that could occur following a syntax error in a query expression. check-in: 54b8968e user: dan tags: trunk
2016-03-12
19:33
Fix a problem handling 'NEAR("" token)' in fts5 found by fuzzing. check-in: 10a827ae user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_expr.c.

   254    254         }
   255    255         pNew->pIndex = 0;
   256    256         pNew->pConfig = pConfig;
   257    257         pNew->apExprPhrase = sParse.apPhrase;
   258    258         pNew->nPhrase = sParse.nPhrase;
   259    259         sParse.apPhrase = 0;
   260    260       }
          261  +  }else{
          262  +    sqlite3Fts5ParseNodeFree(sParse.pExpr);
   261    263     }
   262    264   
   263    265     sqlite3_free(sParse.apPhrase);
   264    266     *pzErr = sParse.zErr;
   265    267     return sParse.rc;
   266    268   }
   267    269   

Changes to ext/fts5/test/fts5fuzz1.test.

    78     78   do_execsql_test 3.2 {
    79     79     CREATE VIRTUAL TABLE f2 USING fts5(o, t, tokenize="ascii separators abc");
    80     80     SELECT * FROM f2('a+4');
    81     81   } {}
    82     82   
    83     83   
    84     84   
    85         -
           85  +#-------------------------------------------------------------------------
           86  +reset_db
           87  +do_catchsql_test 4.1 {
           88  +  CREATE VIRTUAL TABLE f2 USING fts5(o, t);
           89  +  SELECT * FROM f2('(8 AND 9)`AND 10');
           90  +} {1 {fts5: syntax error near "`"}}
    86     91   
    87     92   finish_test
    88         -
    89     93