/ Check-in [c7e5966e]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a segfault that can occur following an OOM in the FTS3 snippet() function
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c7e5966e3b031672f149d0b6e1f75f9bc40868fa
User & Date: dan 2010-01-06 18:36:27
Context
2010-01-07
03:53
Another attempt at fixing the table generator in lemon. Again, this does not effect the SQLite grammar. check-in: e22c090f user: drh tags: trunk
2010-01-06
18:36
Fix a segfault that can occur following an OOM in the FTS3 snippet() function check-in: c7e5966e user: dan tags: trunk
17:19
Change the fts3 snippet function to return (hopefully) more relevant snippets in less time. check-in: 8a208223 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_snippet.c.

   446    446         int iCurrent = 0;
   447    447         int rc;
   448    448         sqlite3_tokenizer_module *pMod;
   449    449         sqlite3_tokenizer_cursor *pC;
   450    450   
   451    451         pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;
   452    452         rc = pMod->xOpen(pTab->pTokenizer, zDoc, nDoc, &pC);
          453  +      if( rc!=SQLITE_OK ){
          454  +        return rc;
          455  +      }
   453    456         pC->pTokenizer = pTab->pTokenizer;
   454    457         while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){
   455    458           const char *ZDUMMY; int DUMMY1, DUMMY2, DUMMY3;
   456    459           rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &DUMMY2, &DUMMY3, &iCurrent);
   457    460         }
   458    461         pMod->xClose(pC);
   459    462         if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){