Hello,

I  got crash with  SQLite FTS3 table search version 3.6.16    .

I am  using SQLite fts3 table to INDEX the data.

Crash occurred while being the executing the sqllite3_step() API.

I  have noticed that this crash is happening  with special search string
"1-2.3" (which contains hypen and dot characters).

OS: Windows XP Service Pack 2.


*here is the sample code which causes the crash:*

/************************************************************************************/
// sqlite1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "sqlite3.h"

sqlite3        *m_hdb;

#define CREATE_FTS_TABLE "CREATE VIRTUAL TABLE fts_attachment USING FTS3
([from], [to], [subject], [filename],[type])"
#define SELECT_FTS "SELECT * FROM fts_attachment WHERE [fts_attachment]
match ?"
#define SEARCH_STR "1-2.3"

void main()
{
    char* unused;
    int ret_;
    sqlite3_stmt *sstmt;

    int v = sqlite3_libversion_number();
    printf("Version: %d\n", v);

    ret_ = sqlite3_open("testfts.db", &m_hdb);
    if(ret_ != SQLITE_OK)
        return;

    // execute create query
    ret_ = sqlite3_prepare(m_hdb, CREATE_FTS_TABLE
,(int)strlen(CREATE_FTS_TABLE) * sizeof(char),
                         &sstmt, (const char **)&unused);

    if(ret_ != SQLITE_OK) {
            printf("%s\n", sqlite3_errmsg(m_hdb));
    } else {
            ret_ = sqlite3_step(sstmt);
            if (ret_ != SQLITE_DONE && ret_ != SQLITE_ROW) {
                printf("%s\n", sqlite3_errmsg(m_hdb));
            }
            sqlite3_finalize(sstmt);
    }
    // Execute select query
    ret_ = sqlite3_prepare(m_hdb, SELECT_FTS ,(int)strlen(SELECT_FTS) *
sizeof(char),
                    &sstmt, (const char **)&unused);

    if(ret_ != SQLITE_OK) {
        printf("%s\n", sqlite3_errmsg(m_hdb));
        return;
    }

    ret_ = sqlite3_bind_text(sstmt, 1, SEARCH_STR,
                                 (int)(strlen(SEARCH_STR) * sizeof(char)),
                                 SQLITE_TRANSIENT);

    if(ret_ != SQLITE_OK){
        printf("%s\n", sqlite3_errmsg(m_hdb));
        return;
    }

    ret_ = sqlite3_step(sstmt);
    if (ret_ != SQLITE_DONE && ret_ != SQLITE_ROW){
        printf("%s\n", sqlite3_errmsg(m_hdb));
        return;
    }

    sqlite3_finalize(sstmt);
    sqlite3_close(m_hdb);
    printf("Done\n");
}

/************************************************************************************/

*Also I am adding the stack trace *
/************************************************************************************/
sqlite1.exe!_fts3ReallocOrFree()  + 0x1897 bytes
sqlite1.exe!_fts3ReallocOrFree()  + 0x18a0 bytes
sqlite1.exe!_fts3ReallocOrFree()  + 0x18af bytes
sqlite1.exe!_sqlite3_test_control()  + 0x2d4f bytes
sqlite1.exe!_sqlite3_finalize()  + 0xa47 bytes
sqlite1.exe!_sqlite3_value_numeric_type()  + 0x57e5 bytes
sqlite1.exe!_sqlite3_step()  + 0x548 bytes
sqlite1.exe!_sqlite3_step()  + 0x5c bytes
sqlite1.exe!main()  Line 57 + 0x9 bytes    C++
sqlite1.exe!__tmainCRTStartup()  Line 266 + 0x19 bytes    C
sqlite1.exe!mainCRTStartup()  Line 182    C
kernel32.dll!7c816fe7()
[Frames below may be incorrect and/or missing, no symbols loaded for
kernel32.dll]

/************************************************************************************/

Waiting for your response,
Subbi Reddy
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to