/ Check-in [444c7c99]
Login

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

Overview
Comment:Fix two more problems with corrupt database handling in fts5.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 444c7c99beb9f8b82963e9784aa2be54124c7011f4771122b4f608c02aa26408
User & Date: dan 2019-01-05 07:17:56
Context
2019-01-05
21:09
If the OP_ParseSchema opcode with a non-NULL P4 operand does not parse any rows out of the sqlite_master table, that indicates that the sqlite_master table is corrupt, so raise an SQLITE_CORRUPT error. check-in: 598d7358 user: drh tags: trunk
07:17
Fix two more problems with corrupt database handling in fts5. check-in: 444c7c99 user: dan tags: trunk
2019-01-04
23:39
Give a meaningful error on an attempt to use UPSERT on a virtual table, rather than simply not working. check-in: fa98748f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_index.c.

  2433   2433     **
  2434   2434     **   1) an error has occurred, or
  2435   2435     **   2) the iterator points to EOF, or
  2436   2436     **   3) the iterator points to an entry with term (pTerm/nTerm), or
  2437   2437     **   4) the FTS5INDEX_QUERY_SCAN flag was set and the iterator points
  2438   2438     **      to an entry with a term greater than or equal to (pTerm/nTerm).
  2439   2439     */
  2440         -  assert( p->rc!=SQLITE_OK                                          /* 1 */
         2440  +  assert_nc( p->rc!=SQLITE_OK                                       /* 1 */
  2441   2441      || pIter->pLeaf==0                                               /* 2 */
  2442   2442      || fts5BufferCompareBlob(&pIter->term, pTerm, nTerm)==0          /* 3 */
  2443   2443      || (bGe && fts5BufferCompareBlob(&pIter->term, pTerm, nTerm)>0)  /* 4 */
  2444   2444     );
  2445   2445   }
  2446   2446   
  2447   2447   /*

Changes to ext/fts5/fts5_storage.c.

   584    584   }
   585    585   
   586    586   int sqlite3Fts5StorageRebuild(Fts5Storage *p){
   587    587     Fts5Buffer buf = {0,0,0};
   588    588     Fts5Config *pConfig = p->pConfig;
   589    589     sqlite3_stmt *pScan = 0;
   590    590     Fts5InsertCtx ctx;
   591         -  int rc;
          591  +  int rc, rc2;
   592    592   
   593    593     memset(&ctx, 0, sizeof(Fts5InsertCtx));
   594    594     ctx.pStorage = p;
   595    595     rc = sqlite3Fts5StorageDeleteAll(p);
   596    596     if( rc==SQLITE_OK ){
   597    597       rc = fts5StorageLoadTotals(p, 1);
   598    598     }
................................................................................
   623    623       p->nTotalRow++;
   624    624   
   625    625       if( rc==SQLITE_OK ){
   626    626         rc = fts5StorageInsertDocsize(p, iRowid, &buf);
   627    627       }
   628    628     }
   629    629     sqlite3_free(buf.p);
          630  +  rc2 = sqlite3_reset(pScan);
          631  +  if( rc==SQLITE_OK ) rc = rc2;
   630    632   
   631    633     /* Write the averages record */
   632    634     if( rc==SQLITE_OK ){
   633    635       rc = fts5StorageSaveTotals(p);
   634    636     }
   635    637     return rc;
   636    638   }

Changes to ext/fts5/test/fts5corrupt3.test.

  2207   2207   |   4080: 68 65 63 6b 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   heck....optimize
  2208   2208   | end c24b.db
  2209   2209   }]} {}
  2210   2210   
  2211   2211   do_catchsql_test 23.1 {
  2212   2212     INSERT INTO t1(t1) VALUES('optimize');
  2213   2213   } {1 {database disk image is malformed}}
         2214  +
         2215  +#--------------------------------------------------------------------------
         2216  +reset_db
         2217  +do_test 24.0 {
         2218  +  sqlite3 db {}
         2219  +  db deserialize [decode_hexdb {
         2220  +| size 32768 pagesize 4096 filename crash-b87dfef02880fe.db
         2221  +| page 1 offset 0
         2222  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
         2223  +|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 08   .....@  ........
         2224  +|     32: 00 00 00 02 00 00 00 01 00 00 00 09 00 00 00 04   ................
         2225  +|     48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00   ................
         2226  +|     96: 00 00 00 00 0d 0f c7 00 07 0d 92 00 0f 8d 0f 36   ...............6
         2227  +|    112: 0e cb 0e 6b 0e 0e 0d b6 0d 92 0d 92 00 00 00 00   ...k............
         2228  +|   3472: 00 00 22 08 06 17 11 11 01 31 74 61 62 6c 65 74   .........1tablet
         2229  +|   3488: 32 74 32 08 43 52 45 41 54 45 20 54 41 42 4c 45   2t2.CREATE TABLE
         2230  +|   3504: 20 74 32 28 78 29 56 07 06 17 1f 1f 01 7d 74 61    t2(x)V.......ta
         2231  +|   3520: 62 6c 65 74 31 5f 63 6f 6e 66 69 67 74 31 5f 63   blet1_configt1_c
         2232  +|   3536: 6f 6e 66 69 67 07 43 52 45 41 54 45 20 54 41 42   onfig.CREATE TAB
         2233  +|   3552: 4c 45 20 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b   LE 't1_config'(k
         2234  +|   3568: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29    PRIMARY KEY, v)
         2235  +|   3584: 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5b 06    WITHOUT ROWID[.
         2236  +|   3600: 07 17 21 21 01 81 01 74 61 62 6c 65 74 31 5f 64   ..!!...tablet1_d
         2237  +|   3616: 6f 63 73 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65   ocsizet1_docsize
         2238  +|   3632: 06 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74   .CREATE TABLE 't
         2239  +|   3648: 31 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 4e   1_docsize'(id IN
         2240  +|   3664: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45   TEGER PRIMARY KE
         2241  +|   3680: 59 2c 20 73 7a 20 42 4c 4f 42 29 5e 05 07 17 21   Y, sz BLOB)^...!
         2242  +|   3696: 21 01 81 07 74 61 62 6c 65 74 31 5f 63 6f 6e 74   !...tablet1_cont
         2243  +|   3712: 65 6e 74 74 31 5f 63 6f 6e 74 65 6e 74 05 43 52   entt1_content.CR
         2244  +|   3728: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63   EATE TABLE 't1_c
         2245  +|   3744: 6f 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 47   ontent'(id INTEG
         2246  +|   3760: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20   ER PRIMARY KEY, 
         2247  +|   3776: 63 30 2c 20 63 31 2c 20 63 32 29 69 04 07 17 19   c0, c1, c2)i....
         2248  +|   3792: 19 01 81 2d 74 61 62 6c 65 74 31 5f 69 64 78 74   ...-tablet1_idxt
         2249  +|   3808: 31 5f 69 64 78 04 43 52 45 41 54 45 20 54 41 42   1_idx.CREATE TAB
         2250  +|   3824: 4c 45 20 27 74 31 5f 69 64 78 27 28 73 65 67 69   LE 't1_idx'(segi
         2251  +|   3840: 64 2c 20 74 65 72 6d 2c 20 70 67 6e 6f 2c 20 50   d, term, pgno, P
         2252  +|   3856: 52 49 4d 41 52 59 20 4b 45 59 28 73 65 67 69 64   RIMARY KEY(segid
         2253  +|   3872: 2c 20 74 65 72 6d 29 29 20 57 49 54 48 4f 55 54   , term)) WITHOUT
         2254  +|   3888: 20 52 4f 57 49 44 55 03 07 17 1b 1b 01 81 01 74    ROWIDU........t
         2255  +|   3904: 61 62 6c 65 74 31 5f 64 61 74 61 74 31 5f 64 61   ablet1_datat1_da
         2256  +|   3920: 74 61 03 43 52 45 41 54 45 20 54 41 42 4c 45 20   ta.CREATE TABLE 
         2257  +|   3936: 27 74 31 5f 64 61 74 61 27 28 69 64 20 49 4e 54   't1_data'(id INT
         2258  +|   3952: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59   EGER PRIMARY KEY
         2259  +|   3968: 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 38 02 06   , block BLOB)8..
         2260  +|   3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52   ...._tablet1t1CR
         2261  +|   4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42   EATE VIRTUAL TAB
         2262  +|   4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 35   LE t1 USING fts5
         2263  +|   4032: 28 61 2c 62 2c 63 29 00 00 00 39 00 00 00 00 00   (a,b,c)...9.....
         2264  +| page 3 offset 8192
         2265  +|      0: 0d 00 00 00 03 0c 94 00 0f e6 0f ef 0c 94 00 00   ................
         2266  +|   3216: 00 00 00 00 86 4a 84 80 80 80 80 01 04 00 8d 18   .....J..........
         2267  +|   3232: 00 00 03 2b 02 30 30 01 02 06 01 02 06 01 02 06   ...+.00.........
         2268  +|   3248: 1f 02 03 01 02 03 01 02 03 01 08 32 30 31 36 30   ...........20160
         2269  +|   3264: 36 30 39 01 02 07 01 02 07 01 02 07 01 01 34 01   609...........4.
         2270  +|   3280: 02 05 01 02 05 01 02 05 01 01 35 01 02 04 01 02   ..........5.....
         2271  +|   3296: 04 01 02 04 02 07 30 30 30 30 30 30 30 1c 02 04   ......0000000...
         2272  +|   3312: 01 02 04 01 02 04 01 06 62 69 6e 61 72 79 03 06   ........binary..
         2273  +|   3328: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01   ................
         2274  +|   3344: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02   ................
         2275  +|   3360: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02   ................
         2276  +|   3376: 03 06 01 02 02 03 06 01 02 02 01 08 63 6f 6d 70   ............comp
         2277  +|   3392: 69 6c 65 72 01 02 02 01 02 02 01 02 02 01 06 64   iler...........d
         2278  +|   3408: 62 73 74 61 74 07 02 03 01 02 03 01 02 03 02 04   bstat...........
         2279  +|   3424: 65 62 75 67 04 02 02 01 02 02 01 02 02 01 06 65   ebug...........e
         2280  +|   3440: 6e 61 62 6c 65 07 02 02 01 02 02 01 02 02 01 02   nable...........
         2281  +|   3456: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02   ................
         2282  +|   3472: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01   ................
         2283  +|   3488: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02   ................
         2284  +|   3504: 02 01 02 02 02 08 78 74 65 6e 73 69 6f 6e 1f 02   ......xtension..
         2285  +|   3520: 04 01 02 04 01 02 04 01 04 66 74 73 34 1a 02 03   .........fts4...
         2286  +|   3536: 01 02 03 01 02 03 04 01 35 0d 02 03 01 02 03 01   ........5.......
         2287  +|   3552: 02 03 01 03 67 63 63 01 02 03 01 02 03 01 02 03   ....gcc.........
         2288  +|   3568: 02 06 65 6f 70 6f 6c 79 10 02 03 01 02 03 01 02   ..eopoly........
         2289  +|   3584: 03 01 05 6a 73 6f 6e 31 13 02 03 01 02 03 01 02   ...json1........
         2290  +|   3600: 03 01 04 6c 6f 61 64 1f 02 03 01 02 03 01 02 03   ...load.........
         2291  +|   3616: 01 03 6d 61 78 1c 02 02 01 02 02 01 02 02 02 05   ..max...........
         2292  +|   3632: 65 6d 6f 72 79 1c 02 03 01 02 03 01 02 03 04 04   emory...........
         2293  +|   3648: 73 79 73 35 16 02 03 01 02 03 01 02 03 01 06 6e   sys5...........n
         2294  +|   3664: 6f 63 61 73 65 02 06 01 02 02 03 06 01 02 02 03   ocase...........
         2295  +|   3680: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06   ................
         2296  +|   3696: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01   ................
         2297  +|   3712: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02   ................
         2298  +|   3728: 02 01 04 6f 6d 69 74 1f 02 02 01 02 02 01 02 02   ...omit.........
         2299  +|   3744: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 02   ................
         2300  +|   3760: 58 81 96 4d 01 06 01 02 02 03 06 01 02 02 03 06   X..M............
         2301  +|   3776: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01   ................
         2302  +|   3792: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02   ................
         2303  +|   3808: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02   ................
         2304  +|   3824: 01 0a 74 68 72 65 61 64 73 61 66 65 22 02 02 01   ..threadsafe....
         2305  +|   3840: 02 02 01 02 02 01 04 76 74 61 62 07 02 04 01 02   .......vtab.....
         2306  +|   3856: 04 01 02 04 01 01 78 01 06 01 01 02 01 06 01 01   ......x.........
         2307  +|   3872: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02   ................
         2308  +|   3888: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01   ................
         2309  +|   3904: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06   ................
         2310  +|   3920: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01   ................
         2311  +|   3936: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01   ................
         2312  +|   3952: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02   ................
         2313  +|   3968: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01   ................
         2314  +|   3984: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06   ................
         2315  +|   4000: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01   ................
         2316  +|   4016: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01   ................
         2317  +|   4032: 02 01 06 01 01 02 01 06 01 01 02 04 15 13 0c 0c   ................
         2318  +|   4048: 12 44 13 11 0f 47 13 0f 0c 0e 11 10 0f 0e 10 0f   .D...G..........
         2319  +|   4064: 44 0f 10 40 15 0f 07 01 03 00 14 24 5a 24 24 0f   D..@.......$Z$$.
         2320  +|   4080: 0a 03 00 24 00 00 00 00 01 01 01 00 01 01 01 01   ...$............
         2321  +| page 4 offset 12288
         2322  +|      0: 0a 00 00 00 01 0f fa 00 0f fa 00 00 00 00 00 00   ................
         2323  +|   4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02   ................
         2324  +| page 5 offset 16384
         2325  +|      0: 0d 00 00 00 24 0c 0a 00 0f d8 0f af 0f 86 0f 74   ....$..........t
         2326  +|     16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e d7 0e be 0e a5   .a.N./..........
         2327  +|     32: 0e 8d 0e 74 0e 5b 0e 40 0e 24 0e 08 0d ef 0d d5   ...t.[.@.$......
         2328  +|     48: 0d bb 0d a0 0d 84 0d 68 0d 4f 0d 35 0d 1b 0c fb   .......h.O.5....
         2329  +|     64: 0c da 0c b9 0c 99 0c 78 0c 57 0c 3e 0c 24 0c 0a   .......x.W.>.$..
         2330  +|   3072: 00 00 00 00 00 00 00 00 00 00 18 24 05 00 25 0f   ...........$..%.
         2331  +|   3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49   .THREADSAFE=0XBI
         2332  +|   3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41   NARY.#..%..THREA
         2333  +|   3120: 44 53 41 46 45 3d 30 58 4e 4f 43 41 53 45 17 22   DSAFE=0XNOCASE..
         2334  +|   3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 45 3d   ..%..THREADSAFE=
         2335  +|   3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d   0XRTRIM.!..3..OM
         2336  +|   3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49 4f   IT LOAD EXTENSIO
         2337  +|   3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 0f 19 4f   NXBINARY. ..3..O
         2338  +|   3200: 4d 49 54 20 4c 4f 41 44 b2 04 55 85 44 54 e5 34   MIT LOAD..U.DT.4
         2339  +|   3216: 94 f4 e5 84 e4 f4 34 15 34 51 e1 f0 50 03 30 f1   ......4.4Q..P.0.
         2340  +|   3232: 74 f4 d4 95 42 04 c4 f4 14 42 04 55 85 44 54 e5   t...B....B.U.DT.
         2341  +|   3248: 34 94 f4 e5 85 25 45 24 94 d1 f1 e0 50 03 30 f1   4....%E$....P.0.
         2342  +|   3264: 94 d4 15 82 04 d4 54 d4 f5 25 93 d3 53 03 03 03   ......T..%..S...
         2343  +|   3280: 03 03 03 05 84 24 94 e4 15 25 91 f1 d0 50 03 30   .....$...%...P.0
         2344  +|   3296: f1 94 d4 15 82 04 d4 54 d4 f5 25 93 d3 53 03 03   .......T..%..S..
         2345  +|   3312: 03 03 03 03 05 84 e4 f4 34 15 34 51 e1 c0 50 03   ........4.4Q..P.
         2346  +|   3328: 30 f1 74 d4 15 82 04 d4 54 d4 f5 25 93 d3 53 03   0.t.....T..%..S.
         2347  +|   3344: 03 03 03 03 03 05 85 25 45 24 94 d1 81 b0 50 02   .......%E$....P.
         2348  +|   3360: 50 f1 94 54 e4 14 24 c4 52 05 25 45 24 54 55 84   P..T..$.R.%E$TU.
         2349  +|   3376: 24 94 e4 15 25 91 81 a0 50 02 50 f1 94 54 e4 14   $...%...P.P..T..
         2350  +|   3392: 24 c4 52 05 25 45 24 54 55 84 e4 f4 34 15 34 51   $.R.%E$TU...4.4Q
         2351  +|   3408: 71 90 50 02 50 f1 74 54 e4 14 24 c4 52 05 25 45   q.P.P.tT..$.R.%E
         2352  +|   3424: 24 54 55 85 25 45 24 94 d1 a1 80 50 02 90 f1 94   $TU.%E$....P....
         2353  +|   3440: 54 e4 14 24 c4 52 04 d4 54 d5 35 95 33 55 84 24   T..$.R..T.5.3U.$
         2354  +|   3456: 94 e4 15 25 91 a1 70 50 02 90 f1 94 54 e4 14 24   ...%..pP....T..$
         2355  +|   3472: c4 52 04 d4 54 d5 35 95 33 55 84 e4 f4 34 15 34   .R..T.5.3U...4.4
         2356  +|   3488: 51 91 60 50 02 90 f1 74 54 e4 14 24 c4 52 04 d4   Q.`P...tT..$.R..
         2357  +|   3504: 54 d5 35 95 33 55 85 25 45 24 94 d1 81 50 50 02   T.5.3U.%E$...PP.
         2358  +|   3520: 50 f1 94 54 e4 14 24 c4 52 04 a5 34 f4 e3 15 84   P..T..$.R..4....
         2359  +|   3536: 24 94 e4 15 25 91 81 40 50 02 50 f1 94 54 e4 14   $...%..@P.P..T..
         2360  +|   3552: 24 c4 52 04 a5 34 f4 e3 15 84 e4 f4 34 15 34 51   $.R..4......4.4Q
         2361  +|   3568: 71 30 50 02 50 f1 74 54 e4 14 24 c4 52 04 a5 34   q0P.P.tT..$.R..4
         2362  +|   3584: f4 e3 15 85 25 45 24 94 d1 a1 20 50 02 90 f1 94   ....%E$... P....
         2363  +|   3600: 54 e4 14 24 c4 52 04 74 54 f5 04 f4 c5 95 84 24   T..$.R.tT......$
         2364  +|   3616: 94 e4 15 25 91 a1 10 50 02 90 f1 94 54 e4 14 24   ...%...P....T..$
         2365  +|   3632: c4 52 04 74 54 f5 04 f4 c5 95 84 e4 f4 34 15 34   .R.tT........4.4
         2366  +|   3648: 51 91 00 50 02 90 f1 74 54 e4 14 24 c4 52 04 74   Q..P...tT..$.R.t
         2367  +|   3664: 54 f5 04 f4 c5 95 85 25 45 24 94 d1 70 f0 50 02   T......%E$..p.P.
         2368  +|   3680: 30 f1 94 54 e4 14 24 c5 20 46 54 53 35 58 42 49   0..T..$. FTS5XBI
         2369  +|   3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c   NARY....#..ENABL
         2370  +|   3712: 45 20 46 54 53 35 58 4e 4f 43 41 53 45 16 0d 05   E FTS5XNOCASE...
         2371  +|   3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58   .#..ENABLE FTS5X
         2372  +|   3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42   RTRIM....#..ENAB
         2373  +|   3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 97 0b   LE FTS4XBINARY..
         2374  +|   3776: 05 00 23 0f 19 45 4e 41 42 4c 45 20 46 54 53 34   ..#..ENABLE FTS4
         2375  +|   3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 0f 17 45 4e   XNOCASE....#..EN
         2376  +|   3808: 41 42 4c 45 20 46 54 53 34 58 52 54 52 49 4d 1e   ABLE FTS4XRTRIM.
         2377  +|   3824: 09 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         2378  +|   3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e   TAT VTABXBINARY.
         2379  +|   3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         2380  +|   3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d   TAT VTABXNOCASE.
         2381  +|   3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         2382  +|   3904: 54 41 54 20 56 54 41 42 58 52 54 52 49 4d 11 06   TAT VTABXRTRIM..
         2383  +|   3920: 05 00 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52   .....DEBUGXBINAR
         2384  +|   3936: 59 11 05 05 00 17 0f 19 44 45 42 55 47 58 4e 4f   Y.......DEBUGXNO
         2385  +|   3952: 43 41 53 45 10 02 02 50 08 5f 17 44 45 42 55 47   CASE...P._.DEBUG
         2386  +|   3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d   XRTRIM'...C..COM
         2387  +|   3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20   PILER=gcc-5.4.0 
         2388  +|   4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27   20160609XBINARY'
         2389  +|   4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67   ...C..COMPILER=g
         2390  +|   4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30   cc-5.4.0 2016060
         2391  +|   4048: 39 58 4e 4f 43 41 53 45 26 01 05 00 43 0f 17 43   9XNOCASE&...C..C
         2392  +|   4064: 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e   OMPILER=gcc-5.4.
         2393  +|   4080: 30 20 32 30 31 36 30 36 30 39 58 52 54 52 49 4d   0 20160609XRTRIM
         2394  +| page 6 offset 20480
         2395  +|      0: 0d 00 00 00 24 0e e0 00 0f f8 0f f0 0f e8 0f e0   ....$...........
         2396  +|     16: 0f d8 0f d0 0f c8 0f c0 0f b8 0f b0 0f a8 0f a0   ................
         2397  +|     32: 0f 98 0f 90 0f 88 0f 80 0f 78 0f 70 0f 68 0f 60   .........x.p.h.`
         2398  +|     48: 0f 58 0f 50 0f 48 0f 40 0f 38 0f 30 0f 28 0f 20   .X.P.H.@.8.0.(. 
         2399  +|     64: 0f 18 0f 10 0f 08 0f 00 0e f8 0e f0 0e e8 0e e0   ................
         2400  +|   3808: 06 24 03 00 12 02 01 01 06 23 03 00 12 02 01 01   .$.......#......
         2401  +|   3824: 06 22 03 00 12 02 01 01 06 21 03 00 12 03 01 01   .........!......
         2402  +|   3840: 06 20 03 00 12 03 01 01 06 1f 03 00 12 03 01 01   . ..............
         2403  +|   3856: 06 1e 03 00 12 03 01 01 06 1d 03 00 12 03 01 01   ................
         2404  +|   3872: 06 1c 03 00 12 03 01 01 06 1b 03 00 12 02 01 01   ................
         2405  +|   3888: 06 1a 03 00 12 02 01 01 06 19 03 00 12 02 01 01   ................
         2406  +|   3904: 06 18 03 00 12 02 01 01 06 17 03 00 12 02 01 01   ................
         2407  +|   3920: 06 16 03 00 12 02 01 01 06 15 03 00 12 02 01 01   ................
         2408  +|   3936: 06 14 03 00 12 02 01 01 06 13 03 00 12 02 01 01   ................
         2409  +|   3952: 06 12 03 00 12 02 01 01 06 11 03 00 12 02 01 01   ................
         2410  +|   3968: 06 10 03 00 12 02 01 01 06 0f 03 00 12 02 01 01   ................
         2411  +|   3984: 06 0e 03 00 12 02 01 01 06 0d 03 00 12 02 01 01   ................
         2412  +|   4000: 06 0c 03 00 12 02 01 01 06 0b 03 00 12 02 01 01   ................
         2413  +|   4016: 06 0a 03 00 12 02 01 01 06 09 03 00 12 03 01 01   ................
         2414  +|   4032: 06 08 03 00 12 03 01 01 06 07 03 00 12 03 01 01   ................
         2415  +|   4048: 06 06 03 00 12 01 01 01 06 05 03 00 12 01 01 01   ................
         2416  +|   4064: 06 04 03 00 12 01 01 01 06 03 03 00 12 06 01 01   ................
         2417  +|   4080: 06 02 03 00 12 06 01 01 06 01 03 00 12 06 01 01   ................
         2418  +| page 7 offset 24576
         2419  +|      0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00   ................
         2420  +|   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
         2421  +| page 8 offset 28672
         2422  +|      0: 0d 00 00 00 03 0f d6 00 0f f4 0f e9 0f d6 00 00   ................
         2423  +|   4048: 00 00 00 00 00 00 11 03 02 2b 69 6e 74 65 67 72   .........+integr
         2424  +|   4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62   ity-check....reb
         2425  +|   4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   uild....optimize
         2426  +| end crash-b87dfef02880fe.db
         2427  +}]} {}
         2428  +
         2429  +do_catchsql_test 24.1 {
         2430  +  UPDATE t1 SET b=quote(zeroblob(200)) WHERE a MATCH 'thread*';
         2431  +} {0 {}}
         2432  +
         2433  +do_catchsql_test 24.2 {
         2434  +  INSERT INTO t1(t1) VALUES('integrity-check');
         2435  +} {1 {database disk image is malformed}}
         2436  +
         2437  +#--------------------------------------------------------------------------
         2438  +reset_db
         2439  +do_test 25.0 {
         2440  +  sqlite3 db {}
         2441  +  db deserialize [decode_hexdb {
         2442  +| size 28672 pagesize 4096 filename crash-e3b1b19e4d4bcc.db
         2443  +| page 1 offset 0
         2444  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
         2445  +|     16: 10 00 01 01 00 40 20 20 00 00 00 06 00 00 00 00   .....@  ........
         2446  +|     32: 00 00 00 00 00 00 00 06 00 00 00 04 00 00 00 00   ................
         2447  +|     48: 03 20 54 35 24 54 15 44 52 04 94 e4 44 55 82 07   . T5$T.DR...DU..
         2448  +|     64: 43 27 a2 04 f4 e2 07 43 22 87 a2 95 30 30 71 71   C'.....C....00qq
         2449  +|     80: 11 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33   .SQLite format 3
         2450  +|     96: 00 10 00 01 0d 00 00 00 07 0d d2 00 0f c4 0f 6d   ...............m
         2451  +|    112: 0f 02 0e ab 0e 4e 0d f6 0d d2 03 30 01 00 00 10   .....N.....0....
         2452  +|    128: 10 04 02 02 00 00 00 00 00 00 00 00 30 00 00 00   ............0...
         2453  +|    144: 00 00 00 00 00 00 00 00 20 00 00 00 40 00 00 00   ........ ...@...
         2454  +|   3536: 00 00 22 07 06 17 11 11 01 31 74 61 62 6c 65 74   .........1tablet
         2455  +|   3552: 32 74 32 07 43 52 45 41 54 45 20 54 41 42 4c 45   2t2.CREATE TABLE
         2456  +|   3568: 20 74 32 28 78 29 56 06 06 17 1f 1f 01 7d 74 61    t2(x)V.......ta
         2457  +|   3584: 62 6c 65 74 31 5f 63 6f 6e 66 69 67 74 31 5f 63   blet1_configt1_c
         2458  +|   3600: 6f 6e 66 69 67 06 43 52 45 41 54 45 20 54 41 42   onfig.CREATE TAB
         2459  +|   3616: 4c 45 20 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b   LE 't1_config'(k
         2460  +|   3632: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29    PRIMARY KEY, v)
         2461  +|   3648: 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5b 05    WITHOUT ROWID[.
         2462  +|   3664: 07 17 21 21 01 81 01 74 61 62 6c 65 74 31 5f 64   ..!!...tablet1_d
         2463  +|   3680: 6f 63 73 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65   ocsizet1_docsize
         2464  +|   3696: 05 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74   .CREATE TABLE 't
         2465  +|   3712: 31 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 4e   1_docsize'(id IN
         2466  +|   3728: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45   TEGER PRIMARY KE
         2467  +|   3744: 59 2c 20 73 7a 20 42 4c 4f 42 29 55 04 06 17 21   Y, sz BLOB)U...!
         2468  +|   3760: 21 01 77 74 61 62 6c 65 74 31 5f 63 6f 6e 74 65   !.wtablet1_conte
         2469  +|   3776: 6e 74 74 31 5f 63 6f 6e 74 65 6e 74 04 43 52 45   ntt1_content.CRE
         2470  +|   3792: 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63 6f   ATE TABLE 't1_co
         2471  +|   3808: 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 47 45   ntent'(id INTEGE
         2472  +|   3824: 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 63   R PRIMARY KEY, c
         2473  +|   3840: 30 29 69 03 07 17 19 19 01 81 2d 74 61 62 6c 65   0)i.......-table
         2474  +|   3856: 74 31 5f 69 64 78 74 31 5f 69 64 78 03 43 52 45   t1_idxt1_idx.CRE
         2475  +|   3872: 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 69 64   ATE TABLE 't1_id
         2476  +|   3888: 78 27 28 73 65 67 69 64 2c 20 74 65 72 6d 2c 20   x'(segid, term, 
         2477  +|   3904: 70 67 6e 6f 2c 20 50 52 49 4d 41 52 59 20 4b 45   pgno, PRIMARY KE
         2478  +|   3920: 59 28 73 65 67 69 64 2c 20 74 65 72 6d 29 29 20   Y(segid, term)) 
         2479  +|   3936: 57 49 54 48 4f 55 54 20 52 4f 57 49 44 55 02 07   WITHOUT ROWIDU..
         2480  +|   3952: 17 1b 1b 01 81 01 74 61 62 6c 65 74 31 5f 64 61   ......tablet1_da
         2481  +|   3968: 74 61 74 31 5f 64 61 74 61 02 43 52 45 41 54 45   tat1_data.CREATE
         2482  +|   3984: 20 54 41 42 4c 45 20 27 74 31 5f 64 61 74 61 27    TABLE 't1_data'
         2483  +|   4000: 28 69 64 20 49 4e 54 45 47 45 52 20 50 52 d9 44   (id INTEGER PR.D
         2484  +|   4016: 41 52 59 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42   ARY KEY, block B
         2485  +|   4032: 4c 4f 42 29 3a 01 06 17 11 11 08 63 74 61 62 6c   LOB):......ctabl
         2486  +|   4048: 65 74 31 74 31 43 52 45 41 54 45 20 56 49 52 54   et1t1CREATE VIRT
         2487  +|   4064: 55 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49   UAL TABLE t1 USI
         2488  +|   4080: 4e 47 20 66 74 73 35 28 63 6f 6e 74 65 6e 74 29   NG fts5(content)
         2489  +| page 2 offset 4096
         2490  +|      0: 0d 00 00 00 03 0f bd 00 0f e8 0f ef 0f bd 00 00   ................
         2491  +|   4016: 00 00 00 00 00 00 00 00 00 00 00 00 00 24 84 80   .............$..
         2492  +|   4032: 80 80 80 01 03 00 4e 00 00 00 1e 06 30 61 62 61   ......N.....0aba
         2493  +|   4048: 63 6b 01 02 02 04 02 66 74 02 02 02 04 04 6e 64   ck.....ft.....nd
         2494  +|   4064: 6f 6e 03 02 02 04 0a 07 05 01 03 00 10 03 03 0f   on..............
         2495  +|   4080: 0a 03 00 24 00 00 00 00 01 01 01 00 01 01 01 01   ...$............
         2496  +| page 3 offset 8192
         2497  +|      0: 0a 00 00 00 01 0f fa 00 0f fa 00 00 00 00 00 00   ................
         2498  +|   4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02   ................
         2499  +| page 4 offset 12288
         2500  +|      0: 0d 00 00 00 03 0f e0 00 0f f6 0f e0 fe 00 00 00   ................
         2501  +|   4064: 0a 03 03 00 1b 61 62 61 6e 64 6f 6e 08 02 00 03   .....abandon....
         2502  +|   4080: 17 61 62 61 66 74 08 01 03 00 17 61 62 61 63 6b   .abaft.....aback
         2503  +| page 5 offset 16384
         2504  +|      0: 0d 00 00 00 03 0f ee 00 0f fa 0f f4 0f ee 00 00   ................
         2505  +|   4064: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 03   ................
         2506  +|   4080: 03 00 0e 01 04 02 03 00 0e 01 04 01 03 00 0e 01   ................
         2507  +| page 6 offset 20480
         2508  +|      0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00   ................
         2509  +|   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
         2510  +| page 7 offset 24576
         2511  +|      0: 0d 00 00 00 03 0f d6 00 0f f4 01 fe 0f d6 00 00   ................
         2512  +|   4048: 00 00 00 00 00 00 09 03 02 1b 72 65 62 75 69 6c   ..........rebuil
         2513  +|   4064: 64 11 02 02 2b 69 6e 74 65 67 72 69 74 79 2d 63   d...+integrity-c
         2514  +|   4080: 68 65 63 6b 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   heck....optimize
         2515  +| end crash-e3b1b19e4d4bcc.db
         2516  +}]} {}
         2517  +
         2518  +do_catchsql_test 25.1 {
         2519  +  INSERT INTO t1(t1) VALUES('rebuild');
         2520  +} {1 {database disk image is malformed}}
         2521  +
         2522  +do_execsql_test 25.2 {
         2523  +  PRAGMA page_size=512;
         2524  +} 
         2525  +
  2214   2526   
  2215   2527   sqlite3_fts5_may_be_corrupt 0
  2216   2528   finish_test
  2217   2529