Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a segfault that could occur if an 'optimize' command was issued on an FTS table that contained at least one row but zero terms. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | branch-3.7.14 |
Files: | files | file ages | folders |
SHA1: |
b21746ac11ecbe1baab6dd715460cc14 |
User & Date: | dan 2014-10-02 09:27:08.018 |
Context
2014-10-02
| ||
09:27 | Fix a segfault that could occur if an 'optimize' command was issued on an FTS table that contained at least one row but zero terms. (Leaf check-in: b21746ac11 user: dan tags: branch-3.7.14) | |
2013-03-07
| ||
11:03 | Avoid an assertion fault and/or freeing memory while it is still in use when an error occurs during virtual table construction. Cherrypick of [a02599ad85d]. (check-in: 760072ceea user: dan tags: branch-3.7.14) | |
Changes
Changes to ext/fts3/fts3_write.c.
︙ | ︙ | |||
3003 3004 3005 3006 3007 3008 3009 | while( SQLITE_OK==rc ){ rc = sqlite3Fts3SegReaderStep(p, &csr); if( rc!=SQLITE_ROW ) break; rc = fts3SegWriterAdd(p, &pWriter, 1, csr.zTerm, csr.nTerm, csr.aDoclist, csr.nDoclist); } if( rc!=SQLITE_OK ) goto finished; | | > | > | 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 | while( SQLITE_OK==rc ){ rc = sqlite3Fts3SegReaderStep(p, &csr); if( rc!=SQLITE_ROW ) break; rc = fts3SegWriterAdd(p, &pWriter, 1, csr.zTerm, csr.nTerm, csr.aDoclist, csr.nDoclist); } if( rc!=SQLITE_OK ) goto finished; assert( pWriter || bIgnoreEmpty ); if( iLevel!=FTS3_SEGCURSOR_PENDING ){ rc = fts3DeleteSegdir( p, iLangid, iIndex, iLevel, csr.apSegment, csr.nSegment ); if( rc!=SQLITE_OK ) goto finished; } if( pWriter ){ rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx); } finished: fts3SegWriterFree(pWriter); sqlite3Fts3SegReaderFinish(&csr); return rc; } |
︙ | ︙ |
Added test/fts3opt.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # 2014 October 2 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing the FTS3 module. # # $Id: fts3aa.test,v 1.1 2007/08/20 17:38:42 shess Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl set ::testprefix fts3opt # If SQLITE_ENABLE_FTS3 is defined, omit this file. ifcapable !fts3 { finish_test return } # Test running an 'optimize' in the case where the index contains zero # terms (so the result is an empty %_segdir table) but there exists at # least one row in the FTS table (i.e. one with no tokens). # do_execsql_test 1.0 { CREATE VIRTUAL TABLE ft USING fts3; INSERT INTO ft(rowid, content) VALUES(1, 'a b c'); INSERT INTO ft(rowid, content) VALUES(2, 'd e f'); INSERT INTO ft(rowid, content) VALUES(3, 'g h i'); INSERT INTO ft(rowid, content) VALUES(4, ''); DELETE FROM ft WHERE rowid=2; DELETE FROM ft WHERE rowid=1; DELETE FROM ft WHERE rowid=3; } {} do_execsql_test 1.1 { INSERT INTO ft(ft) VALUES('optimize'); SELECT * FROM ft_segdir; } {} finish_test |