SQLite

Check-in [c7e5966e3b]
Login

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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c7e5966e3b031672f149d0b6e1f75f9bc40868fa
User & Date: dan 2010-01-06 18:36:27.000
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: e22c090f35 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: c7e5966e3b user: dan tags: trunk)
17:19
Change the fts3 snippet function to return (hopefully) more relevant snippets in less time. (check-in: 8a208223a7 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/fts3/fts3_snippet.c.
446
447
448
449
450
451
452



453
454
455
456
457
458
459
      int iCurrent = 0;
      int rc;
      sqlite3_tokenizer_module *pMod;
      sqlite3_tokenizer_cursor *pC;

      pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;
      rc = pMod->xOpen(pTab->pTokenizer, zDoc, nDoc, &pC);



      pC->pTokenizer = pTab->pTokenizer;
      while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){
        const char *ZDUMMY; int DUMMY1, DUMMY2, DUMMY3;
        rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &DUMMY2, &DUMMY3, &iCurrent);
      }
      pMod->xClose(pC);
      if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){







>
>
>







446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
      int iCurrent = 0;
      int rc;
      sqlite3_tokenizer_module *pMod;
      sqlite3_tokenizer_cursor *pC;

      pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;
      rc = pMod->xOpen(pTab->pTokenizer, zDoc, nDoc, &pC);
      if( rc!=SQLITE_OK ){
        return rc;
      }
      pC->pTokenizer = pTab->pTokenizer;
      while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){
        const char *ZDUMMY; int DUMMY1, DUMMY2, DUMMY3;
        rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &DUMMY2, &DUMMY3, &iCurrent);
      }
      pMod->xClose(pC);
      if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){