/ Check-in [4cdcda40]
Login

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

Overview
Comment:Remove an assert() that could fail on a corrupt db from fts3_write.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4cdcda408a4edcd2845584ddef64f0efdd2b4cc030afbc05fc2b8b555c69d3f6
User & Date: dan 2018-12-21 11:53:43
Context
2018-12-21
13:30
In RTREE, turn an assert() into an if() because the condition can sometimes be false when dealing with a corrupt database. check-in: 99bce435 user: drh tags: trunk
11:53
Remove an assert() that could fail on a corrupt db from fts3_write.c. check-in: 4cdcda40 user: dan tags: trunk
2018-12-20
22:08
Do not set the Cursor.seekOp test variable in the OP_NotExists opcode. This is a change to test logic only and does not affect deliverable builds. check-in: 98f34307 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_write.c.

  1604   1604     const char *zRoot,              /* Buffer containing root node */
  1605   1605     int nRoot,                      /* Size of buffer containing root node */
  1606   1606     Fts3SegReader **ppReader        /* OUT: Allocated Fts3SegReader */
  1607   1607   ){
  1608   1608     Fts3SegReader *pReader;         /* Newly allocated SegReader object */
  1609   1609     int nExtra = 0;                 /* Bytes to allocate segment root node */
  1610   1610   
  1611         -  assert( iStartLeaf<=iEndLeaf );
  1612   1611     if( iStartLeaf==0 ){
  1613   1612       nExtra = nRoot + FTS3_NODE_PADDING;
  1614   1613     }
  1615   1614   
  1616   1615     pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);
  1617   1616     if( !pReader ){
  1618   1617       return SQLITE_NOMEM;

Changes to test/fts3corrupt4.test.

   140    140     UPDATE ft_segdir 
   141    141     SET root = blob('0101056162633132FFFFFFFF070236030132030136');
   142    142   }
   143    143   
   144    144   do_catchsql_test 3.1 {
   145    145     SELECT * FROM ft WHERE ft MATCH 'abc20'
   146    146   } {1 {database disk image is malformed}}
          147  +
          148  +#-------------------------------------------------------------------------
          149  +reset_db
          150  +do_execsql_test 4.0 {
          151  +  CREATE VIRTUAL TABLE t1 USING fts3();
          152  +  INSERT INTO t1 VALUES('one two three');
          153  +  UPDATE t1_segdir SET start_block = 1;
          154  +}
          155  +
          156  +do_catchsql_test 4.1 { 
          157  +  SELECT * FROM t1 WHERE t1 MATCH 'one'; 
          158  +} {1 {database disk image is malformed}}
          159  +do_catchsql_test 4.2 { 
          160  +  SELECT * FROM t1 WHERE t1 MATCH 'two'; 
          161  +} {1 {database disk image is malformed}}
          162  +do_catchsql_test 4.3 { 
          163  +  SELECT * FROM t1 WHERE t1 MATCH 'three'; 
          164  +} {1 {database disk image is malformed}}
          165  +do_execsql_test 4.4 {
          166  +  INSERT INTO t1(t1) VALUES('optimize');
          167  +}
          168  +
   147    169   
   148    170   finish_test