diff options
Diffstat (limited to 'ext/fts5/fts5_tokenize.c')
-rw-r--r-- | ext/fts5/fts5_tokenize.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c index f120561..2200e78 100644 --- a/ext/fts5/fts5_tokenize.c +++ b/ext/fts5/fts5_tokenize.c @@ -79,7 +79,7 @@ static int fts5AsciiCreate( int i; memset(p, 0, sizeof(AsciiTokenizer)); memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar)); - for(i=0; rc==SQLITE_OK && i<nArg; i+=2){ + for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){ const char *zArg = azArg[i+1]; if( 0==sqlite3_stricmp(azArg[i], "tokenchars") ){ fts5AsciiAddExceptions(p, zArg, 1); @@ -90,6 +90,7 @@ static int fts5AsciiCreate( rc = SQLITE_ERROR; } } + if( rc==SQLITE_OK && i<nArg ) rc = SQLITE_ERROR; if( rc!=SQLITE_OK ){ fts5AsciiDelete((Fts5Tokenizer*)p); p = 0; @@ -381,17 +382,16 @@ static int fts5UnicodeCreate( } /* Search for a "categories" argument */ - for(i=0; rc==SQLITE_OK && i<nArg; i+=2){ + for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){ if( 0==sqlite3_stricmp(azArg[i], "categories") ){ zCat = azArg[i+1]; } } - if( rc==SQLITE_OK ){ rc = unicodeSetCategories(p, zCat); } - for(i=0; rc==SQLITE_OK && i<nArg; i+=2){ + for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){ const char *zArg = azArg[i+1]; if( 0==sqlite3_stricmp(azArg[i], "remove_diacritics") ){ if( (zArg[0]!='0' && zArg[0]!='1' && zArg[0]!='2') || zArg[1] ){ @@ -416,6 +416,7 @@ static int fts5UnicodeCreate( rc = SQLITE_ERROR; } } + if( i<nArg && rc==SQLITE_OK ) rc = SQLITE_ERROR; }else{ rc = SQLITE_NOMEM; @@ -1298,7 +1299,7 @@ static int fts5TriCreate( int i; pNew->bFold = 1; pNew->iFoldParam = 0; - for(i=0; rc==SQLITE_OK && i<nArg; i+=2){ + for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){ const char *zArg = azArg[i+1]; if( 0==sqlite3_stricmp(azArg[i], "case_sensitive") ){ if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1] ){ @@ -1316,6 +1317,7 @@ static int fts5TriCreate( rc = SQLITE_ERROR; } } + if( i<nArg && rc==SQLITE_OK ) rc = SQLITE_ERROR; if( pNew->iFoldParam!=0 && pNew->bFold==0 ){ rc = SQLITE_ERROR; |