SQLite

Check-in [54b8968e33]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 54b8968e335760105206b894672213c1d56771a4
User & Date: dan 2016-03-14 12:16:23.063
Context
2016-03-14
15:03
Run TCL tests in the "testdir" subdirectory. (check-in: 90e0cc7b0b user: drh tags: trunk)
13:42
Run TCL tests in a subdirectory "testdir". (check-in: f632bba0d6 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: 54b8968e33 user: dan tags: trunk)
2016-03-12
19:33
Fix a problem handling 'NEAR("" token)' in fts5 found by fuzzing. (check-in: 10a827ae5f user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/fts5/fts5_expr.c.
254
255
256
257
258
259
260


261
262
263
264
265
266
267
      }
      pNew->pIndex = 0;
      pNew->pConfig = pConfig;
      pNew->apExprPhrase = sParse.apPhrase;
      pNew->nPhrase = sParse.nPhrase;
      sParse.apPhrase = 0;
    }


  }

  sqlite3_free(sParse.apPhrase);
  *pzErr = sParse.zErr;
  return sParse.rc;
}








>
>







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

  sqlite3_free(sParse.apPhrase);
  *pzErr = sParse.zErr;
  return sParse.rc;
}

Changes to ext/fts5/test/fts5fuzz1.test.
78
79
80
81
82
83
84
85





86
87
88
89
do_execsql_test 3.2 {
  CREATE VIRTUAL TABLE f2 USING fts5(o, t, tokenize="ascii separators abc");
  SELECT * FROM f2('a+4');
} {}










finish_test









|
>
>
>
>
>


<

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

93
do_execsql_test 3.2 {
  CREATE VIRTUAL TABLE f2 USING fts5(o, t, tokenize="ascii separators abc");
  SELECT * FROM f2('a+4');
} {}



#-------------------------------------------------------------------------
reset_db
do_catchsql_test 4.1 {
  CREATE VIRTUAL TABLE f2 USING fts5(o, t);
  SELECT * FROM f2('(8 AND 9)`AND 10');
} {1 {fts5: syntax error near "`"}}

finish_test