SQLite

Check-in [04298f1ac4]
Login

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

Overview
Comment:Change the ICU tokenizer so that it does not attempt to call strlen(NULL).
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 04298f1ac42c40cb2a48092b415acf96a08954b7
User & Date: dan 2012-03-31 11:58:23.752
References
2012-10-15
23:15
Change the ICU tokenizer so that it does not attempt to call strlen(NULL). This is a cherry-pick of the fix in [04298f1ac42c40c] on 2012-03-31 first appearing in release 3.7.12. (check-in: 49ffbc11c5 user: drh tags: branch-3.7.9)
Context
2012-03-31
15:08
Modify selectColumnsFromExprList() to avoid ever incorrectly returning SQLITE_NOMEM. (check-in: e7cb6b73ac user: dan tags: trunk)
11:58
Change the ICU tokenizer so that it does not attempt to call strlen(NULL). (check-in: 04298f1ac4 user: dan tags: trunk)
09:59
Fix a bug in the EXPLAIN code for listing trigger programs that was causing an out-of-bounds read. (check-in: c9342ca581 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/fts3/fts3_icu.c.
106
107
108
109
110
111
112



113
114
115
116
117
118
119
120

  UChar32 c;
  int iInput = 0;
  int iOut = 0;

  *ppCursor = 0;




  if( nInput<0 ){
    nInput = strlen(zInput);
  }
  nChar = nInput+1;
  pCsr = (IcuCursor *)sqlite3_malloc(
      sizeof(IcuCursor) +                /* IcuCursor */
      nChar * sizeof(UChar) +            /* IcuCursor.aChar[] */
      (nChar+1) * sizeof(int)            /* IcuCursor.aOffset[] */







>
>
>
|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

  UChar32 c;
  int iInput = 0;
  int iOut = 0;

  *ppCursor = 0;

  if( zInput==0 ){
    nInput = 0;
    zInput = "";
  }else if( nInput<0 ){
    nInput = strlen(zInput);
  }
  nChar = nInput+1;
  pCsr = (IcuCursor *)sqlite3_malloc(
      sizeof(IcuCursor) +                /* IcuCursor */
      nChar * sizeof(UChar) +            /* IcuCursor.aChar[] */
      (nChar+1) * sizeof(int)            /* IcuCursor.aOffset[] */
Changes to test/fts3defer.test.
485
486
487
488
489
490
491


































492
493
  INSERT INTO x2 VALUES('a b c d e f g h i j k l m n o p q r s t u v w x y m');
  COMMIT;
}
do_execsql_test 4.2 {
  SELECT * FROM x2 WHERE x2 MATCH 'a b c d e f g h i j k l m n o p q r s';
} {{a b c d e f g h i j k l m n o p q r s t u v w x y m}}




































finish_test







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


485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
  INSERT INTO x2 VALUES('a b c d e f g h i j k l m n o p q r s t u v w x y m');
  COMMIT;
}
do_execsql_test 4.2 {
  SELECT * FROM x2 WHERE x2 MATCH 'a b c d e f g h i j k l m n o p q r s';
} {{a b c d e f g h i j k l m n o p q r s t u v w x y m}}

set tokenizers {1 simple}
ifcapable icu { lappend tokenizers 2 {icu en_US} }
foreach {tn tokenizer} $tokenizers {
  do_execsql_test 5.$tn.1 "
    CREATE VIRTUAL TABLE x3 USING FTS4(a, b, TOKENIZE $tokenizer)
  "
  do_execsql_test 5.$tn.2 {
    BEGIN;
    INSERT INTO x3 VALUES('b b b b b b b b b b b', 'b b b b b b b b b b b b b');
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 SELECT * FROM x3;
    INSERT INTO x3 VALUES('a b c', NULL);
    INSERT INTO x3 VALUES('a x c', NULL);
    COMMIT;

    SELECT * FROM x3 WHERE x3 MATCH 'a b';
  } {{a b c} {}}

  do_execsql_test 5.$tn.3 { DROP TABLE x3 }
}

finish_test