/ Check-in [b39bf435]
Login

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

Overview
Comment:Improved detection of shadow table corruption in RTREE.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b39bf4356e6bcf1d8442721d6cbbfe06caba01325104fb469da8fe69e1f623a2
User & Date: drh 2018-12-21 22:08:59
Context
2018-12-21
22:11
Update the dbtotxt utility program so that it does not output characters that are special to TCL, thus making the output of dbtotxt easier to insert into test scripts. check-in: 48438bb3 user: drh tags: trunk
22:08
Improved detection of shadow table corruption in RTREE. check-in: b39bf435 user: drh tags: trunk
20:18
Add new sqlite3_prepare_v3() flag SQLITE_PREPARE_NO_VTAB, for preparing statements that are not allowed to use any virtual tables. Use this to prevent circular references in triggers on virtual table shadow tables from causing resource leaks. check-in: da587d18 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

   630    630   static void nodeBlobReset(Rtree *pRtree){
   631    631     if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){
   632    632       sqlite3_blob *pBlob = pRtree->pNodeBlob;
   633    633       pRtree->pNodeBlob = 0;
   634    634       sqlite3_blob_close(pBlob);
   635    635     }
   636    636   }
          637  +
          638  +/*
          639  +** Check to see if pNode is the same as pParent or any of the parents
          640  +** of pParent.
          641  +*/
          642  +static int nodeInParentChain(const RtreeNode *pNode, const RtreeNode *pParent){
          643  +  do{
          644  +    if( pNode==pParent ) return 1;
          645  +    pParent = pParent->pParent;
          646  +  }while( pParent );
          647  +  return 0;
          648  +}
   637    649   
   638    650   /*
   639    651   ** Obtain a reference to an r-tree node.
   640    652   */
   641    653   static int nodeAcquire(
   642    654     Rtree *pRtree,             /* R-tree structure */
   643    655     i64 iNode,                 /* Node number to load */
................................................................................
   649    661   
   650    662     /* Check if the requested node is already in the hash table. If so,
   651    663     ** increase its reference count and return it.
   652    664     */
   653    665     if( (pNode = nodeHashLookup(pRtree, iNode))!=0 ){
   654    666       assert( !pParent || !pNode->pParent || pNode->pParent==pParent );
   655    667       if( pParent && !pNode->pParent ){
          668  +      if( nodeInParentChain(pNode, pParent) ){
          669  +        RTREE_IS_CORRUPT(pRtree);
          670  +        return SQLITE_CORRUPT_VTAB;
          671  +      }
   656    672         pParent->nRef++;
   657    673         pNode->pParent = pParent;
   658    674       }
   659    675       pNode->nRef++;
   660    676       *ppNode = pNode;
   661    677       return SQLITE_OK;
   662    678     }
................................................................................
  3221   3237         pRtree->iReinsertHeight = -1;
  3222   3238         rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0);
  3223   3239         rc2 = nodeRelease(pRtree, pLeaf);
  3224   3240         if( rc==SQLITE_OK ){
  3225   3241           rc = rc2;
  3226   3242         }
  3227   3243       }
  3228         -    if( pRtree->nAux ){
         3244  +    if( rc==SQLITE_OK && pRtree->nAux ){
  3229   3245         sqlite3_stmt *pUp = pRtree->pWriteAux;
  3230   3246         int jj;
  3231   3247         sqlite3_bind_int64(pUp, 1, *pRowid);
  3232   3248         for(jj=0; jj<pRtree->nAux; jj++){
  3233   3249           sqlite3_bind_value(pUp, jj+2, aData[pRtree->nDim2+3+jj]);
  3234   3250         }
  3235   3251         sqlite3_step(pUp);

Changes to ext/rtree/rtreefuzz001.test.

   479    479   |     32: 00 00 00 00 01 00 00 00 00 00 00 04 00 00 00 04   ................
   480    480   |     48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00   ................
   481    481   |     96: 00 00 00 00 0d 00 00 00 04 0e 9c 00 0f ad 0f 4f   ...............O
   482    482   |    112: 0e fc 0e 9c 00 00 00 00 00 00 00 00 00 00 00 00   ................
   483    483   |   3728: 00 00 00 00 00 00 00 00 00 00 00 00 5e 04 07 17   ............^...
   484    484   |   3744: 1f 1f 01 81 0b 74 61 62 6c 65 74 31 5f 70 61 72   .....tablet1_par
   485    485   |   3760: 65 6e 74 74 31 5f 70 61 72 65 6e 74 04 43 52 45   entt1_parent.CRE
   486         -|   3776: 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 70 61   ATE TABLE "t1_pa
   487         -|   3792: 72 65 6e 74 22 28 6e 6f 64 65 6e 6f 20 49 4e 54   rent"(nodeno INT
          486  +|   3776: 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 70 61   ATE TABLE .t1_pa
          487  +|   3792: 72 65 6e 74 22 28 6e 6f 64 65 6e 6f 20 49 4e 54   rent.(nodeno INT
   488    488   |   3808: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59   EGER PRIMARY KEY
   489    489   |   3824: 2c 70 61 72 65 6e 74 6e 6f 64 65 29 51 03 06 17   ,parentnode)Q...
   490    490   |   3840: 1b 1b 01 7b 74 61 62 6c 65 74 31 5f 6e 6f 64 65   ....tablet1_node
   491    491   |   3856: 74 31 5f 6e 6f 64 65 03 43 52 45 41 54 45 20 54   t1_node.CREATE T
   492         -|   3872: 41 42 4c 45 20 22 74 31 5f 6e 6f 64 65 22 28 6e   ABLE "t1_node"(n
          492  +|   3872: 41 42 4c 45 20 22 74 31 5f 6e 6f 64 65 22 28 6e   ABLE .t1_node.(n
   493    493   |   3888: 6f 64 65 6e 6f 20 49 4e 54 45 47 45 52 20 50 52   odeno INTEGER PR
   494         -|   3904: 49 4d 41 52 59 20 4b 45 59 2c 64 61 74 61 29 5c   IMARY KEY,data)\
          494  +|   3904: 49 4d 41 52 59 20 4b 45 59 2c 64 61 74 61 29 5c   IMARY KEY,data).
   495    495   |   3920: 02 07 17 1d 1d 01 81 0b 74 61 62 6c 65 74 31 5f   ........tablet1_
   496    496   |   3936: 72 6f 77 69 64 74 31 5f 72 6f 77 69 64 02 43 52   rowidt1_rowid.CR
   497         -|   3952: 45 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 72   EATE TABLE "t1_r
   498         -|   3968: 6f 77 69 64 22 28 72 6f 77 69 64 20 49 4e 54 45   owid"(rowid INTE
          497  +|   3952: 45 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 72   EATE TABLE .t1_r
          498  +|   3968: 6f 77 69 64 22 28 72 6f 77 69 64 20 49 4e 54 45   owid.(rowid INTE
   499    499   |   3984: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c   GER PRIMARY KEY,
   500    500   |   4000: 6e 6f 64 65 6e 6f 2c 61 30 2c 61 31 29 51 01 07   nodeno,a0,a1)Q..
   501    501   |   4016: 17 11 11 08 81 0f 74 61 62 6c 65 74 31 74 31 43   ......tablet1t1C
   502    502   |   4032: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41   REATE VIRTUAL TA
   503    503   |   4048: 42 4c 45 20 74 31 20 55 53 49 4e 47 20 72 74 72   BLE t1 USING rtr
   504    504   |   4064: 65 65 28 69 64 2c 78 30 2c 78 31 2c 79 30 2c 79   ee(id,x0,x1,y0,y
   505    505   |   4080: 31 2c 2b 6c 61 62 65 6c 2c 2b 6f 74 68 65 72 29   1,+label,+other)
................................................................................
   556    556     catchsql {
   557    557       WITH RECURSIVE
   558    558         c1(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c1 WHERE x<99),
   559    559         c2(y) AS (VALUES(0) UNION ALL SELECT y+1 FROM c2 WHERE y<99)
   560    560       INSERT INTO t1(id, x0,x1,y0,y1,label)
   561    561         SELECT 1000+x+y*100, x, x+1, y, y+1, printf('box-%d,%d',x,y) FROM c1, c2;
   562    562     }
   563         -} {1 {malformed database schema (?)}}
          563  +} {1 {database disk image is malformed}}
   564    564   do_test rtreefuzz001-210 {
   565    565     catchsql {
   566    566       SELECT rtreecheck('t1');
   567    567     }
   568         -} {1 {database disk image is malformed}}
          568  +} {/1 .*corrupt.*/}
   569    569   
   570    570   do_test rtreefuzz001-300 {
   571    571     sqlite3 db {}
   572    572     db deserialize [decode_hexdb {
   573    573   | size 16384 pagesize 4096 filename c4.db
   574    574   | page 1 offset 0
   575    575   |      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
................................................................................
   576    576   |     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 04   .....@  ........
   577    577   |     32: 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 04   ................
   578    578   |     96: 00 00 00 00 0d 00 00 00 04 0e 9c 00 0f ad 0f 4f   ...............O
   579    579   |    112: 0e fc 0e 9c 00 00 00 00 00 00 00 00 00 00 00 00   ................
   580    580   |   3728: 00 00 00 00 00 00 00 00 00 00 00 00 5e 04 07 17   ............^...
   581    581   |   3744: 1f 1f 01 81 0b 74 61 62 6c 65 74 31 5f 70 61 72   .....tablet1_par
   582    582   |   3760: 65 6e 74 74 31 5f 70 61 72 65 6e 74 04 43 52 45   entt1_parent.CRE
   583         -|   3776: 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 70 61   ATE TABLE "t1_pa
   584         -|   3792: 72 65 6e 74 22 28 6e 6f 64 65 6e 6f 20 49 4e 54   rent"(nodeno INT
          583  +|   3776: 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 70 61   ATE TABLE .t1_pa
          584  +|   3792: 72 65 6e 74 22 28 6e 6f 64 65 6e 6f 20 49 4e 54   rent.(nodeno INT
   585    585   |   3808: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59   EGER PRIMARY KEY
   586    586   |   3824: 2c 70 61 72 65 6e 74 6e 6f 64 65 29 51 03 06 17   ,parentnode)Q...
   587    587   |   3840: 1b 1b 01 7b 74 61 62 6c 65 74 31 5f 6e 6f 64 65   ....tablet1_node
   588    588   |   3856: 74 31 5f 6e 6f 64 65 03 43 52 45 41 54 45 20 54   t1_node.CREATE T
   589         -|   3872: 41 42 4c 45 20 22 74 31 5f 6e 6f 64 65 22 28 6e   ABLE "t1_node"(n
          589  +|   3872: 41 42 4c 45 20 22 74 31 5f 6e 6f 64 65 22 28 6e   ABLE .t1_node.(n
   590    590   |   3888: 6f 64 65 6e 6f 20 49 4e 54 45 47 45 52 20 50 52   odeno INTEGER PR
   591         -|   3904: 49 4d 41 52 59 20 4b 45 59 2c 64 61 74 61 29 5c   IMARY KEY,data)\
          591  +|   3904: 49 4d 41 52 59 20 4b 45 59 2c 64 61 74 61 29 5c   IMARY KEY,data).
   592    592   |   3920: 02 07 17 1d 1d 01 81 0b 74 61 62 6c 65 74 31 5f   ........tablet1_
   593    593   |   3936: 72 6f 77 69 64 74 31 5f 72 6f 77 69 64 02 43 52   rowidt1_rowid.CR
   594         -|   3952: 45 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 72   EATE TABLE "t1_r
   595         -|   3968: 6f 77 69 64 22 28 72 6f 77 69 64 20 49 4e 54 45   owid"(rowid INTE
          594  +|   3952: 45 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 72   EATE TABLE .t1_r
          595  +|   3968: 6f 77 69 64 22 28 72 6f 77 69 64 20 49 4e 54 45   owid.(rowid INTE
   596    596   |   3984: 47 45 72 20 50 52 49 4d 41 52 59 20 4b 45 59 2c   GEr PRIMARY KEY,
   597    597   |   4000: 6e 6f 64 65 6e 6f 2c 61 30 2c 61 31 29 51 01 07   nodeno,a0,a1)Q..
   598    598   |   4016: 17 11 11 08 81 0f 74 61 62 6c 65 74 31 74 31 43   ......tablet1t1C
   599    599   |   4032: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41   REATE VIRTUAL TA
   600    600   |   4048: 42 4c 45 20 74 31 20 55 53 49 4e 47 20 72 74 72   BLE t1 USING rtr
   601    601   |   4064: 65 65 28 69 64 2c 78 30 2c 78 31 2c 79 30 2c 79   ee(id,x0,x1,y0,y
   602    602   |   4080: 31 2c 2b 6c 61 62 65 6c 2c 2b 6f 74 68 65 72 29   1,+label,+other)
................................................................................
   644    644   |   3136: 06 c6 56 67 42 06 86 16 c6 61 40 a0 50 00 92 b0   ..VgB....a@.P...
   645    645   |   3152: 07 46 86 52 07 76 86 f6 c6 52 07 46 86 96 e6 70   .F.R.v...R.F...p
   646    646   |   3168: d0 90 50 00 91 d0 07 46 f7 02 06 56 46 76 51 00   ..P....F...VFvQ.
   647    647   |   3184: 80 50 00 92 30 06 26 f7 47 46 f6 d2 06 56 46 76   .P..0.&.GF...VFv
   648    648   |   3200: 50 f0 70 50 00 92 10 07 26 96 76 87 42 06 56 46   P.pP....&.v.B.VF
   649    649   |   3216: 76 50 e0 60 50 00 91 f0 06 c6 56 67 42 06 56 46   vP.`P.....VgB.VF
   650    650   |   3232: 76 50 b0 50 50 00 91 90 06 36 56 e7 46 57 21 70   vP.PP....6V.FW!p
   651         -|   3248: 40 50 00 93 10 07 57 07 06 57 22 d7 26 96 76 87   @P....W..W".&.v.
          651  +|   3248: 40 50 00 93 10 07 57 07 06 57 22 d7 26 96 76 87   @P....W..W..&.v.
   652    652   |   3264: 42 06 36 f7 26 e6 57 21 70 30 50 00 93 10 06 c6   B.6.&.W!p0P.....
   653         -|   3280: f7 76 57 22 d7 26 96 76 87 42 06 36 f7 26 e6 57   .vW".&.v.B.6.&.W
   654         -|   3296: 21 60 20 50 00 92 f0 07 57 07 06 57 22 d6 c6 56   !` P....W..W"..V
          653  +|   3280: f7 76 57 22 d7 26 96 76 87 42 06 36 f7 26 e6 57   .vW..&.v.B.6.&.W
          654  +|   3296: 21 60 20 50 00 92 f0 07 57 07 06 57 22 d6 c6 56   !` P....W..W...V
   655    655   |   3312: 60 00 00 c4 24 c0 00 04 2c 80 00 00 00 00 00 04   `...$...,.......
   656    656   |   3328: 2c 80 00 00 00 00 00 00 00 00 00 d0 00 00 00 04   ,...............
   657    657   |   3344: 2c 80 00 00 00 00 00 04 24 80 00 00 00 00 00 00   ,.......$.......
   658    658   |   3360: 00 00 00 e0 00 00 00 04 2c 80 00 04 24 c0 00 04   ........,...$...
   659    659   |   3376: 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ,...............
   660    660   | page 4 offset 12288
   661    661   |      0: 0d 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00   ................
   662    662   | end c4.db
   663    663     }]
   664    664     catchsql {
   665    665       UPDATE t1 SET label='x';
   666    666     }
   667         -} {1 {malformed database schema (?)}}
          667  +} {1 {rtree constraint failed: t1.(y0<=y1)}}
   668    668   do_test rtreefuzz001-310 {
   669    669     catchsql {
   670    670       SELECT rtreecheck('t1');
   671    671     }
   672         -} {1 {database disk image is malformed}}
          672  +} {/1 .*corrupt.*/}
   673    673   
          674  +do_test rtreefuzz001-400 {
          675  +  sqlite3 db {}
          676  +  db deserialize [decode_hexdb {
          677  +| size 16384 pagesize 4096 filename c7.db
          678  +| page 1 offset 0
          679  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
          680  +|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 04   .....@  ........
          681  +|     32: 00 00 00 00 01 00 00 00 00 00 00 04 00 00 00 04   ................
          682  +|     48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00   ................
          683  +|     96: 00 00 00 00 0d 00 00 00 04 0e 9c 00 0f ad 0f 4f   ...............O
          684  +|    112: 0e fc 0e 9c 00 00 00 00 00 00 00 00 00 00 00 00   ................
          685  +|   3728: 00 00 00 00 00 00 00 00 00 00 00 00 5e 04 07 17   ............^...
          686  +|   3744: 1f 1f 01 81 0b 74 61 62 6c 65 74 31 5f 70 61 72   .....tablet1_par
          687  +|   3760: 65 6e 74 74 31 5f 70 61 72 65 6e 74 04 43 52 45   entt1_parent.CRE
          688  +|   3776: 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 70 61   ATE TABLE .t1_pa
          689  +|   3792: 72 65 6e 74 22 28 6e 6f 64 65 6e 6f 20 49 4e 54   rent.(nodeno INT
          690  +|   3808: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59   EGER PRIMARY KEY
          691  +|   3824: 2c 70 61 72 65 6e 74 6e 6f 64 65 29 51 03 06 17   ,parentnode)Q...
          692  +|   3840: 1b 1b 01 7b 74 61 62 6c 65 74 31 5f 6e 6f 64 65   ....tablet1_node
          693  +|   3856: 74 31 5f 6e 6f 64 65 03 43 52 45 41 54 45 20 54   t1_node.CREATE T
          694  +|   3872: 41 42 4c 45 20 22 74 31 5f 6e 6f 64 65 22 28 6e   ABLE .t1_node.(n
          695  +|   3888: 6f 64 65 6e 6f 20 49 4e 54 45 47 45 52 20 50 52   odeno INTEGER PR
          696  +|   3904: 49 4d 41 52 59 20 4b 45 59 2c 64 61 74 61 29 5c   IMARY KEY,data).
          697  +|   3920: 02 07 17 1d 1d 01 81 0b 74 61 62 6c 65 74 31 5f   ........tablet1_
          698  +|   3936: 72 6f 77 69 64 74 31 5f 72 6f 77 69 64 02 43 52   rowidt1_rowid.CR
          699  +|   3952: 45 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 72   EATE TABLE .t1_r
          700  +|   3968: 6f 77 69 64 22 28 72 6f 77 69 64 20 49 4e 54 45   owid.(rowid INTE
          701  +|   3984: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c   GER PRIMARY KEY,
          702  +|   4000: 6e 6f 64 65 6e 6f 2c 61 30 2c 61 31 29 51 01 07   nodeno,a0,a1)Q..
          703  +|   4016: 17 11 11 08 81 0f 74 61 62 6c 65 74 31 74 31 43   ......tablet1t1C
          704  +|   4032: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41   REATE VIRTUAL TA
          705  +|   4048: 42 4c 45 20 74 31 20 55 53 49 4e 47 20 72 74 72   BLE t1 USING rtr
          706  +|   4064: 65 65 28 69 64 2c 78 30 2c 78 31 2c 79 30 2c 79   ee(id,x0,x1,y0,y
          707  +|   4080: 31 2c 2b 6c 61 62 65 6c 2c 2b 6f 74 68 65 72 29   1,+label,+other)
          708  +| page 2 offset 4096
          709  +|      0: 0d 00 00 00 0e 0e f7 00 0f e8 0f d0 0f b7 0f 9e   ................
          710  +|     16: 0f 91 0f 81 0f 70 0f 5e 0f 4f 0f 39 0f 29 0f 18   .....p.^.O.9.)..
          711  +|     32: 0f 06 0e f7 00 00 00 00 00 00 00 00 00 00 00 00   ................
          712  +|   3824: 00 00 00 00 00 00 00 0d 0e 05 00 09 1d 00 74 6f   ..............to
          713  +|   3840: 70 20 68 61 6c 66 10 0d 05 00 09 23 00 62 6f 74   p half.....#.bot
          714  +|   3856: 74 6f 6d 20 68 61 6c 66 0f 0c 05 00 09 21 00 72   tom half.....!.r
          715  +|   3872: 69 67 68 74 20 68 61 6c 66 0e 0b 05 00 09 1f 00   ight half.......
          716  +|   3888: 6c 65 66 74 20 68 61 6c 66 14 0a 05 00 09 2b 00   left half.....+.
          717  +|   3904: 74 68 65 20 77 68 6f 6c 65 20 74 68 69 6e 67 0d   the whole thing.
          718  +|   3920: 09 05 00 09 1d 00 74 6f 70 20 65 64 67 65 10 08   ......top edge..
          719  +|   3936: 05 00 09 23 00 62 6f 74 74 6f 6d 20 65 64 67 65   ...#.bottom edge
          720  +|   3952: 0f 07 05 00 09 21 00 72 69 67 68 74 20 65 64 67   .....!.right edg
          721  +|   3968: 65 0e 06 05 00 09 1f 00 6c 65 66 74 20 65 64 67   e.......left edg
          722  +|   3984: 65 0b 05 05 00 09 19 00 23 65 6e 74 65 72 17 04   e.......#enter..
          723  +|   4000: 05 00 09 31 00 75 70 70 65 72 2d 72 69 67 68 74   ...1.upper-right
          724  +|   4016: 20 63 6f 72 6e 65 72 17 03 05 00 09 31 00 6c 6f    corner.....1.lo
          725  +|   4032: 77 65 72 2d 72 69 67 68 74 20 63 6f 72 6e 65 72   wer-right corner
          726  +|   4048: 16 02 05 00 09 2f 00 75 70 70 65 72 2d 6c 65 66   ...../.upper-lef
          727  +|   4064: 74 20 63 6f 72 6e 65 72 16 01 05 00 09 2f 00 6c   t corner...../.l
          728  +|   4080: 6f 77 65 72 2d 6c 65 66 74 20 63 6f 72 6e 65 72   ower-left corner
          729  +| page 3 offset 8192
          730  +|      0: 0d 00 00 00 02 0b 2d 00 0b 2d 00 00 00 00 00 00   ......-..-......
          731  +|   2848: 00 00 00 00 00 00 00 00 00 00 00 00 00 89 50 01   ..............P.
          732  +|   2864: 04 00 93 24 00 00 00 00 00 00 00 00 08 00 00 00   ...$............
          733  +|   2880: 00 42 c8 00 00 00 00 00 00 40 a0 00 00 00 00 00   .B.......@......
          734  +|   2896: 00 00 00 00 42 c8 00 00 00 00 00 00 00 00 00 07   ....B...........
          735  +|   2912: 42 be 00 00 42 c8 00 00 00 00 00 00 42 c8 00 00   B...B.......B...
          736  +|   2928: 00 00 00 00 00 00 00 08 00 00 00 00 42 c8 00 00   ............B...
          737  +|   2944: 00 00 00 00 40 a0 00 00 00 00 00 00 00 00 00 09   ....@...........
          738  +|   2960: 00 00 00 00 42 c8 00 00 42 be 00 00 42 c8 00 00   ....B...B...B...
          739  +|   2976: 00 00 00 00 00 00 00 0a 00 00 00 00 42 c8 00 00   ............B...
          740  +|   2992: 00 00 00 00 42 c8 00 00 00 00 00 00 00 00 00 0b   ....B...........
          741  +|   3008: 00 00 00 00 42 48 00 00 00 00 00 04 2c 80 00 00   ....BH......,...
          742  +|   3024: 00 00 00 00 00 00 00 c4 00 00 00 00 00 42 c8 00   .............B..
          743  +|   3040: 00 00 00 00 00 00 00 00 07 42 be 00 00 42 c8 00   .........B...B..
          744  +|   3056: 00 00 00 00 00 42 c8 00 00 00 00 00 00 00 00 00   .....B..........
          745  +|   3072: 08 00 00 00 00 42 c8 00 00 00 00 00 00 40 a0 00   .....B.......@..
          746  +|   3088: 00 00 00 00 00 00 00 00 09 00 00 00 00 42 c8 00   .............B..
          747  +|   3104: 00 42 be 00 00 42 c8 00 00 00 00 00 00 00 00 00   .B...B..........
          748  +|   3120: 0a 00 00 00 00 42 c8 00 00 00 00 00 00 42 c8 00   .....B.......B..
          749  +|   3136: 00 00 00 00 00 00 00 00 0b 00 00 00 00 42 48 00   .............BH.
          750  +|   3152: 00 00 00 00 04 2c 80 00 00 00 00 00 00 00 00 00   .....,..........
          751  +|   3168: c4 24 c0 00 04 2c 80 00 00 00 00 00 04 2c 80 00   .$...,.......,..
          752  +|   3184: 00 00 00 00 00 00 00 00 d0 00 00 00 04 2c 80 00   .............,..
          753  +|   3200: 00 00 00 00 04 24 80 00 00 00 00 00 00 00 00 00   .....$..........
          754  +|   3216: e0 00 00 00 04 2c 80 00 04 24 c0 00 04 2c 00 00   .....,...$...,..
          755  +| page 4 offset 12288
          756  +|      0: 0d 00 00 00 00 10 00 00 00 00 00 00 0e 00 00 00   ................
          757  +|     16: 00 42 c8 00 00 42 4c 00 00 42 c8 00 00 00 00 00   .B...BL..B......
          758  +|     32: 00 00 00 0a 00 00 00 00 42 c8 00 00 00 00 00 00   ........B.......
          759  +|     48: 42 c8 00 00 00 00 00 00 00 00 00 0b 00 00 00 00   B...............
          760  +|     64: 42 48 00 00 00 00 00 04 2c 80 00 00 00 00 00 00   BH......,.......
          761  +|     80: 00 00 00 c4 24 c0 00 04 2c 80 00 00 00 00 00 04   ....$...,.......
          762  +|     96: 2c 80 00 00 00 00 00 00 00 00 00 d0 00 00 00 04   ,...............
          763  +|    112: 2c 80 00 00 00 00 00 04 24 80 00 00 00 00 00 00   ,.......$.......
          764  +|    128: 00 00 00 e0 00 00 00 04 2c 80 00 04 24 c0 00 04   ........,...$...
          765  +|    144: 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ,...............
          766  +| end c7.db
          767  +  }]
          768  +  catchsql {
          769  +    WITH RECURSIVE
          770  +      c1(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c1 WHERE x<8),
          771  +      c2(y) AS (VALUES(0) UNION ALL SELECT y+1 FROM c2 WHERE y<5)
          772  +    INSERT INTO t1(id, x0,x1,y0,y1,label)
          773  +      SELECT 1000+x+y*100, x, x+1, y, y+1, printf('box-%d,%d',x,y) FROM c1, c2;
          774  +  }
          775  +} {1 {database disk image is malformed}}
   674    776   
   675    777   finish_test