SQLite

Check-in [a4e976a0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ensure that the sqlite3_index_info.idxStr string coming back from FTS5 is always zero-terminated, even if the xBestIndex call fails with an SQLITE_CONSTRAINT error.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256: a4e976a030851357049e672bbc0ff66d9cc152b3d5f8e03fff36a7c6f060a755
User & Date: drh 2024-11-12 13:37:00
Context
2024-11-12
13:37
Ensure that the sqlite3_index_info.idxStr string coming back from FTS5 is always zero-terminated, even if the xBestIndex call fails with an SQLITE_CONSTRAINT error. (Leaf check-in: a4e976a0 user: drh tags: trunk)
2024-11-11
21:11
Clarify the documentation to make it clear that rows inserted by a CREATE TABLE AS SELECT statement are not counted by sqlite3_count64(). Forum post 1e6cde5648. (check-in: 5c5982e3 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_main.c.

628
629
630
631
632
633
634

635
636
637
638
639
640
641
    if( p->op==SQLITE_INDEX_CONSTRAINT_MATCH
     || (p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol>=nCol)
    ){
      /* A MATCH operator or equivalent */
      if( p->usable==0 || iCol<0 ){
        /* As there exists an unusable MATCH constraint this is an 
        ** unusable plan. Return SQLITE_CONSTRAINT. */

        return SQLITE_CONSTRAINT;
      }else{
        if( iCol==nCol+1 ){
          if( bSeenRank ) continue;
          idxStr[iIdxStr++] = 'r';
          bSeenRank = 1;
        }else{







>







628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
    if( p->op==SQLITE_INDEX_CONSTRAINT_MATCH
     || (p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol>=nCol)
    ){
      /* A MATCH operator or equivalent */
      if( p->usable==0 || iCol<0 ){
        /* As there exists an unusable MATCH constraint this is an 
        ** unusable plan. Return SQLITE_CONSTRAINT. */
        idxStr[iIdxStr] = 0;
        return SQLITE_CONSTRAINT;
      }else{
        if( iCol==nCol+1 ){
          if( bSeenRank ) continue;
          idxStr[iIdxStr++] = 'r';
          bSeenRank = 1;
        }else{