Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix bug in fts2 handling of OR queries. When one doclist ends before the other, the code potentially tries to read past the end of the doclist. http://www.sqlite.org/cvstrac/tktview?tn=2309 (CVS 3862) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
dfac6082e8ffc52a85c4906107a7fc0e |
User & Date: | shess 2007-04-19 18:36:32.000 |
Context
2007-04-20
| ||
12:22 | Remove the ARRAYSIZE macro from where.c to avoid a name conflict with microsoft header files. Ticket #2311 (CVS 3863) (check-in: 9389a15f35 user: drh tags: trunk) | |
2007-04-19
| ||
18:36 | Fix bug in fts2 handling of OR queries. When one doclist ends before the other, the code potentially tries to read past the end of the doclist. http://www.sqlite.org/cvstrac/tktview?tn=2309 (CVS 3862) (check-in: dfac6082e8 user: shess tags: trunk) | |
14:48 | Better fix than (3860) for the same problem. (3860) could leave file-handles open in some circumstances. (CVS 3861) (check-in: 5ad645339b user: danielk1977 tags: trunk) | |
Changes
Changes to ext/fts2/fts2.c.
︙ | ︙ | |||
1370 1371 1372 1373 1374 1375 1376 | } dlrInit(&left, DL_DOCIDS, pLeft, nLeft); dlrInit(&right, DL_DOCIDS, pRight, nRight); dlwInit(&writer, DL_DOCIDS, pOut); while( !dlrAtEnd(&left) || !dlrAtEnd(&right) ){ | | | > > > > > > | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | } dlrInit(&left, DL_DOCIDS, pLeft, nLeft); dlrInit(&right, DL_DOCIDS, pRight, nRight); dlwInit(&writer, DL_DOCIDS, pOut); while( !dlrAtEnd(&left) || !dlrAtEnd(&right) ){ if( dlrAtEnd(&right) ){ dlwAdd(&writer, dlrDocid(&left)); dlrStep(&left); }else if( dlrAtEnd(&left) ){ dlwAdd(&writer, dlrDocid(&right)); dlrStep(&right); }else if( dlrDocid(&left)<dlrDocid(&right) ){ dlwAdd(&writer, dlrDocid(&left)); dlrStep(&left); }else if( dlrDocid(&right)<dlrDocid(&left) ){ dlwAdd(&writer, dlrDocid(&right)); dlrStep(&right); }else{ dlwAdd(&writer, dlrDocid(&left)); dlrStep(&left); dlrStep(&right); } |
︙ | ︙ |
Changes to test/fts2g.test.
1 2 3 4 5 6 7 8 9 | # 2006 October 19 # # The author disclaims copyright to this source code. # #************************************************************************* # This file implements regression tests for SQLite library. The focus # of this script is testing handling of edge cases for various doclist # merging functions in the FTS2 module query logic. # | | > | 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 | # 2006 October 19 # # The author disclaims copyright to this source code. # #************************************************************************* # This file implements regression tests for SQLite library. The focus # of this script is testing handling of edge cases for various doclist # merging functions in the FTS2 module query logic. # # $Id: fts2g.test,v 1.2 2007/04/19 18:36:32 shess Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_ENABLE_FTS2 is defined, omit this file. ifcapable !fts2 { finish_test return } db eval { CREATE VIRTUAL TABLE t1 USING fts2(content); INSERT INTO t1 (rowid, content) VALUES(1, 'this is a test'); INSERT INTO t1 (rowid, content) VALUES(2, 'also a test'); } # No hits at all. Returns empty doclists from termSelect(). do_test fts2g-1.1 { execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'} } {} |
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 | execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this something'} } {} # No support for all-except queries. do_test fts2g-1.10 { catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'} } {1 {SQL logic error or missing database}} finish_test | > > > > > > > > > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this something'} } {} # No support for all-except queries. do_test fts2g-1.10 { catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'} } {1 {SQL logic error or missing database}} # Test that docListOrMerge() correctly handles reaching the end of one # doclist before it reaches the end of the other. do_test fts2g-1.11 { execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR also'} } {1 2} do_test fts2g-1.12 { execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'also OR this'} } {1 2} finish_test |