Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a double-free that can occur when using the fts3 legacy syntax '-' operator. Add tests for the same operator. Ticket #3960. (CVS 6874) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c19d419e8cf94a26d9bb6ad478e84841 |
User & Date: | danielk1977 2009-07-10 09:24:43.000 |
References
2009-08-19
| ||
15:22 | • Ticket [92c5deed07] FTS3 bug with multiple terms for exclusion status still Closed with 1 other change (artifact: a0e3345c24 user: drh) | |
Context
2009-07-10
| ||
16:51 | Fix a pager reference count leak in btree that occurs on an OOM following a database page size change. (CVS 6875) (check-in: c6dfc8bd39 user: drh tags: trunk) | |
09:24 | Fix a double-free that can occur when using the fts3 legacy syntax '-' operator. Add tests for the same operator. Ticket #3960. (CVS 6874) (check-in: c19d419e8c user: danielk1977 tags: trunk) | |
02:52 | Simplifications to the PRAGMA integrity_check logic in btree.c. (CVS 6873) (check-in: 440c573c7e user: drh tags: trunk) | |
Changes
Changes to ext/fts3/fts3_expr.c.
︙ | ︙ | |||
534 535 536 537 538 539 540 | rc = SQLITE_NOMEM; goto exprparse_out; } memset(pNot, 0, sizeof(Fts3Expr)); pNot->eType = FTSQUERY_NOT; pNot->pRight = p; if( pNotBranch ){ | < | > | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | rc = SQLITE_NOMEM; goto exprparse_out; } memset(pNot, 0, sizeof(Fts3Expr)); pNot->eType = FTSQUERY_NOT; pNot->pRight = p; if( pNotBranch ){ pNot->pLeft = pNotBranch; } pNotBranch = pNot; p = pPrev; }else{ int eType = p->eType; assert( eType!=FTSQUERY_PHRASE || !p->pPhrase->isNot ); isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft); /* The isRequirePhrase variable is set to true if a phrase or ** an expression contained in parenthesis is required. If a |
︙ | ︙ | |||
619 620 621 622 623 624 625 | if( rc==SQLITE_DONE ){ rc = SQLITE_OK; if( !sqlite3_fts3_enable_parentheses && pNotBranch ){ if( !pRet ){ rc = SQLITE_ERROR; }else{ | > > > > | | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | if( rc==SQLITE_DONE ){ rc = SQLITE_OK; if( !sqlite3_fts3_enable_parentheses && pNotBranch ){ if( !pRet ){ rc = SQLITE_ERROR; }else{ Fts3Expr *pIter = pNotBranch; while( pIter->pLeft ){ pIter = pIter->pLeft; } pIter->pLeft = pRet; pRet = pNotBranch; } } } *pnConsumed = n - nIn; exprparse_out: |
︙ | ︙ |
Changes to test/fts3expr.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2006 September 9 # # 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. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2006 September 9 # # 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: fts3expr.test,v 1.8 2009/07/10 09:24:43 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_ENABLE_FTS3 is defined, omit this file. ifcapable !fts3 { |
︙ | ︙ | |||
459 460 461 462 463 464 465 | 11 "one two OR four five NOT three" {3 7 11 15 19 23 24 25 26 27 31} 12 "(one two OR four five) NOT three" {3 11 19 24 25 26 27} 13 "((((((one two OR four five)))))) NOT three" {3 11 19 24 25 26 27} } { | | > > > > > > > > > > > > > > > > | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | 11 "one two OR four five NOT three" {3 7 11 15 19 23 24 25 26 27 31} 12 "(one two OR four five) NOT three" {3 11 19 24 25 26 27} 13 "((((((one two OR four five)))))) NOT three" {3 11 19 24 25 26 27} } { do_test fts3expr-6.1.$id { execsql { SELECT rowid FROM t1 WHERE t1 MATCH $expr ORDER BY rowid } } $res } set sqlite_fts3_enable_parentheses 0 foreach {id expr res} { 1 "one -two three" {5 13 21 29} 2 "-two one three" {5 13 21 29} 3 "one three -two" {5 13 21 29} 4 "-one -two three" {4 12 20 28} 5 "three -one -two" {4 12 20 28} 6 "-one three -two" {4 12 20 28} } { do_test fts3expr-6.2.$id { execsql { SELECT rowid FROM t1 WHERE t1 MATCH $expr ORDER BY rowid } } $res } set sqlite_fts3_enable_parentheses 1 do_test fts3expr-7.1 { execsql { CREATE VIRTUAL TABLE test USING fts3 (keyword); INSERT INTO test VALUES ('abc'); SELECT * FROM test WHERE keyword MATCH '""'; } } {} set sqlite_fts3_enable_parentheses 0 finish_test |