/ Check-in [8d964e1c]
Login

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

Overview
Comment:In fts5, fix a case of overreading a buffer by 1 byte when counting characters in malformed utf-8. Fix for [dd1f67bf].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8d964e1c21d4cea699023e02b0616a75c5859dd083c9365cdcbc0676ebbdaae4
User & Date: dan 2019-10-24 20:35:27
Context
2019-10-25
14:46
Performance optimization in sqlite3BtreeCursor(). check-in: ea068b09 user: drh tags: trunk
2019-10-24
23:43
Merge fixes from trunk. Closed-Leaf check-in: 4ec57d88 user: drh tags: generated-columns
20:35
In fts5, fix a case of overreading a buffer by 1 byte when counting characters in malformed utf-8. Fix for [dd1f67bf]. check-in: 8d964e1c user: dan tags: trunk
19:35
Correction to check-in [bec5b6d4d083556d] so that it detects *all* triggers that might perturb the insertion cursor. Ticket [50c09fc2cf0d91ce]. check-in: 521f1d36 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_index.c.

5314
5315
5316
5317
5318
5319
5320

5321
5322
5323
5324
5325
5326
5327
  int nChar
){
  int n = 0;
  int i;
  for(i=0; i<nChar; i++){
    if( n>=nByte ) return 0;      /* Input contains fewer than nChar chars */
    if( (unsigned char)p[n++]>=0xc0 ){

      while( (p[n] & 0xc0)==0x80 ){
        n++;
        if( n>=nByte ) break;
      }
    }
  }
  return n;







>







5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
  int nChar
){
  int n = 0;
  int i;
  for(i=0; i<nChar; i++){
    if( n>=nByte ) return 0;      /* Input contains fewer than nChar chars */
    if( (unsigned char)p[n++]>=0xc0 ){
      if( n>=nByte ) break;
      while( (p[n] & 0xc0)==0x80 ){
        n++;
        if( n>=nByte ) break;
      }
    }
  }
  return n;

Changes to ext/fts5/test/fts5misc.test.

213
214
215
216
217
218
219













220
221
222
223
do_execsql_test 7.1 {
  SELECT rowid FROM t1 WHERE (rowid, x) IN (SELECT a, b FROM t2); 
}

do_execsql_test 7.2 {
  SELECT rowid FROM t1 WHERE rowid=2 AND t1 = 'hello';
}















finish_test








>
>
>
>
>
>
>
>
>
>
>
>
>




213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
do_execsql_test 7.1 {
  SELECT rowid FROM t1 WHERE (rowid, x) IN (SELECT a, b FROM t2); 
}

do_execsql_test 7.2 {
  SELECT rowid FROM t1 WHERE rowid=2 AND t1 = 'hello';
}

#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 8.0 {
  CREATE VIRTUAL TABLE vt0 USING fts5(c0, tokenize = "ascii", prefix = 1);
  INSERT INTO vt0(c0) VALUES (x'd1');
}

breakpoint
do_execsql_test 8.1 {
  INSERT INTO vt0(vt0) VALUES('integrity-check');
}


finish_test