/ Check-in [a5e9cc79]
Login

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

Overview
Comment:Handle SQL NULL values without crashing in the fts5 snippet() and highlight() functions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a5e9cc794f17566160c4b2b5791601a744a21ace987b19ff8a5816fd78dce56a
User & Date: dan 2019-01-15 18:14:27
Context
2019-01-15
20:51
Fix a problem with ALTER TABLE and vector assignments in UPDATE statements within triggers. check-in: cc6cd753 user: dan tags: trunk
18:14
Handle SQL NULL values without crashing in the fts5 snippet() and highlight() functions. check-in: a5e9cc79 user: dan tags: trunk
16:14
Fix a buffer overread in fts3 caused by a corrupt record. check-in: e54efd60 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_aux.c.

   132    132   ** *pRc is set to an error code before returning. 
   133    133   */
   134    134   static void fts5HighlightAppend(
   135    135     int *pRc, 
   136    136     HighlightContext *p, 
   137    137     const char *z, int n
   138    138   ){
   139         -  if( *pRc==SQLITE_OK ){
          139  +  if( *pRc==SQLITE_OK && z ){
   140    140       if( n<0 ) n = (int)strlen(z);
   141    141       p->zOut = sqlite3_mprintf("%z%.*s", p->zOut, n, z);
   142    142       if( p->zOut==0 ) *pRc = SQLITE_NOMEM;
   143    143     }
   144    144   }
   145    145   
   146    146   /*

Changes to ext/fts5/test/fts5ak.test.

   139    139     --   '[a b c d e]'
   140    140     SELECT highlight(ft, 0, '[', ']') FROM ft WHERE ft MATCH 'a+b+c AND c+d+e';
   141    141   } {
   142    142     {[a b c] x [c d e]}
   143    143     {[a b c] [c d e]}
   144    144     {[a b c d e]}
   145    145   }
          146  +
          147  +do_execsql_test 3.2 {
          148  +  SELECT highlight(ft, 0, NULL, NULL) FROM ft WHERE ft MATCH 'a+b+c AND c+d+e';
          149  +} {
          150  +  {a b c x c d e}
          151  +  {a b c c d e}
          152  +  {a b c d e}
          153  +}
   146    154   
   147    155   }
   148    156   
   149    157   finish_test