Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Avoid fts3 crash on (MATCH '""') expressions. Ticket #3717. (CVS 6343) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
03679857a320517a7b89e5214e948bce |
User & Date: | danielk1977 2009-03-12 15:43:48.000 |
Context
2009-03-13
| ||
15:32 | Do not overrun a buffer in the genfkey code (now part of shell.c). Fix for #3722. (CVS 6344) (check-in: 943b11fb18 user: danielk1977 tags: trunk) | |
2009-03-12
| ||
15:43 | Avoid fts3 crash on (MATCH '""') expressions. Ticket #3717. (CVS 6343) (check-in: 03679857a3 user: danielk1977 tags: trunk) | |
14:43 | Make calls to sqlite3BtreeRollbackStmt() no-ops when passed a Btree* handle that does not have an open statement transaction. Ticket #3718. (CVS 6342) (check-in: a1bb1aef0e user: danielk1977 tags: trunk) | |
Changes
Changes to ext/fts3/fts3_expr.c.
︙ | ︙ | |||
208 209 210 211 212 213 214 | zTemp = fts3ReallocOrFree(zTemp, nTemp + nToken); if( !p || !zTemp ){ goto no_mem; } if( ii==0 ){ memset(p, 0, nByte); p->pPhrase = (Fts3Phrase *)&p[1]; | < < | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | zTemp = fts3ReallocOrFree(zTemp, nTemp + nToken); if( !p || !zTemp ){ goto no_mem; } if( ii==0 ){ memset(p, 0, nByte); p->pPhrase = (Fts3Phrase *)&p[1]; } p->pPhrase = (Fts3Phrase *)&p[1]; p->pPhrase->nToken = ii+1; p->pPhrase->aToken[ii].n = nToken; memcpy(&zTemp[nTemp], zToken, nToken); nTemp += nToken; if( iEnd<nInput && zInput[iEnd]=='*' ){ |
︙ | ︙ | |||
233 234 235 236 237 238 239 | } if( rc==SQLITE_DONE ){ int jj; char *zNew; int nNew = 0; int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase); | | | | | > > > > > > | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | } if( rc==SQLITE_DONE ){ int jj; char *zNew; int nNew = 0; int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase); nByte += (p?(p->pPhrase->nToken-1):0) * sizeof(struct PhraseToken); p = fts3ReallocOrFree(p, nByte + nTemp); if( !p ){ goto no_mem; } if( zTemp ){ zNew = &(((char *)p)[nByte]); memcpy(zNew, zTemp, nTemp); }else{ memset(p, 0, nByte+nTemp); } p->pPhrase = (Fts3Phrase *)&p[1]; for(jj=0; jj<p->pPhrase->nToken; jj++){ p->pPhrase->aToken[jj].z = &zNew[nNew]; nNew += p->pPhrase->aToken[jj].n; } sqlite3_free(zTemp); p->eType = FTSQUERY_PHRASE; p->pPhrase->iColumn = pParse->iDefaultCol; rc = SQLITE_OK; } *ppExpr = p; return rc; no_mem: |
︙ | ︙ |
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.7 2009/03/12 15:43:48 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_ENABLE_FTS3 is defined, omit this file. ifcapable !fts3 { |
︙ | ︙ | |||
463 464 465 466 467 468 469 470 471 472 | 13 "((((((one two OR four five)))))) NOT three" {3 11 19 24 25 26 27} } { do_test fts3expr-6.$id { execsql { SELECT rowid FROM t1 WHERE t1 MATCH $expr ORDER BY rowid } } $res } set sqlite_fts3_enable_parentheses 0 finish_test | > > > > > > > > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | 13 "((((((one two OR four five)))))) NOT three" {3 11 19 24 25 26 27} } { do_test fts3expr-6.$id { execsql { SELECT rowid FROM t1 WHERE t1 MATCH $expr ORDER BY rowid } } $res } 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 |