xref: /sqlite-3.40.0/test/corruptL.test (revision dac7e69d)
1# 2019-01-11
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12
13set testdir [file dirname $argv0]
14source $testdir/tester.tcl
15set testprefix corruptL
16
17database_may_be_corrupt
18
19#-------------------------------------------------------------------------
20reset_db
21do_test 1.0 {
22  sqlite3 db {}
23  db deserialize [decode_hexdb {
24| size 356352 pagesize 4096 filename crash-acaae0347204ae.db
25| page 1 offset 0
26|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
27|     16: 10 00 01 01 00 40 20 20 00 00 00 00 d0 00 00 00   .....@  ........
28|     32: 40 00 ea 00 00 00 00 00 00 40 00 00 00 40 00 00   @........@...@..
29|     96: 00 00 00 00 0d 00 00 00 04 0e 9c 00 0f ad 0f 4f   ...............O
30|    112: 0e fc 0e 9c 00 00 00 00 00 00 00 00 00 00 00 00   ................
31|   3728: 00 00 00 00 00 00 00 00 00 00 00 00 5e 04 07 17   ............^...
32|   3744: 1f 1f 01 81 0b 74 61 62 6c 65 74 31 5f 70 61 72   .....tablet1_par
33|   3760: 65 6e 74 74 31 5f 70 61 72 65 6e 74 04 43 52 45   entt1_parent.CRE
34|   3776: 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 70 61   ATE TABLE .t1_pa
35|   3792: 72 65 6e 74 22 28 6e 6f 64 65 6e 6f 20 49 4e 54   rent.(nodeno INT
36|   3808: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59   EGER PRIMARY KEY
37|   3824: 2c 70 61 72 65 6e 74 6e 6f 64 65 29 51 03 06 17   ,parentnode)Q...
38|   3840: 1b 1b 01 7b 74 61 62 6c 65 74 31 5f 6e 6f 64 65   ....tablet1_node
39|   3856: 74 31 5f 6e 6f 64 65 03 43 52 45 41 54 45 20 54   t1_node.CREATE T
40|   3872: 41 42 4c 45 20 22 74 31 5f 6e 6f 64 65 22 28 6e   ABLE .t1_node.(n
41|   3888: 6f 64 65 6e 6f 20 49 4e 54 45 47 45 52 20 50 52   odeno INTEGER PR
42|   3904: 49 4d 41 52 59 20 4b 45 59 2c 64 61 74 61 29 5c   IMARY KEY,data).
43|   3920: 02 07 17 1d 1d 01 81 0b 74 61 62 6c 65 74 31 5f   ........tablet1_
44|   3936: 72 6f 77 69 64 74 31 5f 72 6f 77 69 64 02 43 52   rowidt1_rowid.CR
45|   3952: 45 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 72   EATE TABLE .t1_r
46|   3968: 6f 77 69 64 22 28 72 6f 77 69 64 20 49 4e 54 45   owid.(rowid INTE
47|   3984: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c   GER PRIMARY KEY,
48|   4000: 6e 6f 64 65 6e 6f 2c 61 30 2c 61 31 29 51 01 07   nodeno,a0,a1)Q..
49|   4016: 17 11 11 08 81 0f 74 61 62 6c 65 74 31 74 31 43   ......tablet1t1C
50|   4032: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41   REATE VIRTUAL TA
51|   4048: 42 4c 45 20 74 31 20 55 53 49 4e 47 20 72 74 72   BLE t1 USING rtr
52|   4064: 65 65 28 69 64 2c 78 30 20 50 52 49 4d 41 52 59   ee(id,x0 PRIMARY
53|   4080: 20 4b 45 59 2c 70 61 72 65 6e 74 6e 6f 64 65 29    KEY,parentnode)
54| page 2 offset 4096
55|      0: 51 03 06 17 1b 1b 01 7b 74 61 62 6c 65 74 31 5f   Q.......tablet1_
56|     16: 6e 6f 64 65 74 31 5f 6e 6f 64 65 03 43 52 45 41   nodet1_node.CREA
57|     32: 54 45 20 54 41 42 4c 45 20 22 74 31 5f 6e 6f 64   TE TABLE .t1_nod
58|     48: 65 22 28 6e 6f 64 65 6e 6f 20 49 4e 54 45 47 45   e.(nodeno INTEGE
59|     64: 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 64 61   R PRIMARY KEY,da
60|     80: 74 61 29 5c 02 07 17 1d 1d 01 81 0b 74 61 62 6c   ta).........tabl
61|     96: 65 74 31 5f 72 6f 77 69 64 74 31 5f 72 6f 77 69   et1_rowidt1_rowi
62|    112: 64 02 43 52 45 41 54 45 20 54 41 42 4c 45 00 00   d.CREATE TABLE..
63|    128: 01 0a 02 00 00 00 01 0e 0d 00 00 00 00 24 0e 0d   .............$..
64|    144: 0c 1a 06 85 50 46 60 27 70 08 00 00 00 00 00 00   ....PF`'p.......
65|   3824: 00 00 00 00 00 00 00 0d 0e 05 00 09 1d 00 74 6f   ..............to
66|   3840: 79 20 68 61 6c 66 10 0d 05 00 09 23 00 62 6f 74   y half.....#.bot
67|   3856: 74 6f 6d 20 68 61 6c 66 0f 0c 05 00 09 21 00 72   tom half.....!.r
68|   3872: 69 67 68 74 20 68 61 6c 66 0e 0b 05 00 09 1f 00   ight half.......
69|   3888: 6c 65 66 74 20 43 15 f6 e6 f6 46 50 34 35 24 54   left C....FP45$T
70|   3904: 15 44 52 05 44 14 24 c4 52 02 27 43 15 f6 e6 f6   .DR.D.$.R.'C....
71|   3920: 46 52 22 8e 6f 64 65 6e 6f 20 49 4e 54 45 47 45   FR..odeno INTEGE
72|   3936: 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 64 61   R PRIMARY KEY,da
73|   3952: 74 61 29 5c 02 07 17 1d 1d 01 81 0b 74 61 62 6c   ta).........tabl
74|   3968: 65 74 31 5f 72 6f 74 74 6f 6d 20 65 64 67 65 0f   et1_rottom edge.
75|   3984: 07 05 00 09 21 00 72 69 67 68 74 20 65 64 67 65   ....!.right edge
76|   4000: 0e 06 05 00 09 1f 00 6c 65 66 74 20 65 64 67 65   .......left edge
77|   4016: 0b 05 05 00 09 19 00 63 65 6e 74 65 72 17 04 05   .......center...
78|   4032: 00 09 31 00 75 70 70 65 72 2d 72 69 67 68 74 20   ..1.upper-right
79|   4048: 63 6f 72 6e 65 72 17 03 05 00 09 31 00 6c 6f 77   corner.....1.low
80|   4064: 65 72 2d 72 69 67 68 74 20 63 6f 72 6e 65 72 16   er-right corner.
81|   4080: 02 05 00 09 2f 00 75 70 70 65 72 2d 6c 65 66 74   ..../.upper-left
82| page 3 offset 8192
83|      0: 20 63 6f 72 6e 65 72 16 01 05 00 09 2f 01 8c 6f    corner...../..o
84|     16: 77 65 72 2d 6c 53 51 4c 69 74 65 20 66 6f 72 6d   wer-lSQLite form
85|     32: 61 74 20 33 00 10 00 01 01 00 40 20 20 00 00 00   at 3......@  ...
86|     48: 00 00 00 00 2f 00 00 0d eb 13 00 00 00 03 00 00   ..../...........
87|     64: 00 04 00 00 00 00 00 00 00 06 00 00 00 01 00 00   ................
88|     80: 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00   ................
89| page 6 offset 20480
90|    128: 00 00 00 00 00 00 00 00 97 3d 04 ae 7c 01 00 00   .........=..|...
91|    624: 00 00 00 00 00 00 21 97 3d 04 ae 7c 01 00 00 00   ......!.=..|....
92|   1120: 00 00 00 00 00 20 97 3d 04 ae 7c 01 00 00 00 00   ..... .=..|.....
93|   1616: 00 00 00 00 1f 97 3d 04 ae 7c 01 00 00 00 00 00   ......=..|......
94|   2112: 00 00 00 1e 97 3d 04 ae 7c 01 00 00 00 00 00 00   .....=..|.......
95|   2608: 00 00 1d 97 d3 d0 4a e7 c0 00 00 00 00 00 00 00   ......J.........
96|   3088: 00 00 00 00 00 00 00 00 00 00 00 00 01 f3 00 00   ................
97|   3600: 23 97 3d 04 ae 7c 01 00 00 00 00 00 00 00 00 00   #.=..|..........
98|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 26   ...............&
99| page 8 offset 28672
100|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
101|   1072: 97 4d 1e 14 00 ae 7c 00 00 00 00 00 00 00 00 00   .M....|.........
102|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
103|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03   ................
104| page 10 offset 36864
105|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
106|   1072: 9a ee c1 80 fd 78 1f ce 1b ae eb b4 00 00 00 00   .....x..........
107|   1088: 13 20 ff 20 00 70 00 00 00 60 50 00 00 00 11 e0   . . .p...`P.....
108|   1104: 00 00 00 70 00 00 00 60 50 05 35 14 c6 97 46 52   ...p...`P.5...FR
109|   1120: 06 66 f7 26 d6 17 42 03 30 01 00 00 10 10 04 02   .f.&..B.0.......
110|   1136: 02 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00   .........@......
111|   1152: 00 00 00 00 00 40 00 00 00 40 00 00 00 00 00 00   .....@...@......
112|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05   ................
113| page 12 offset 45056
114|      0: 0d 00 00 00 01 04 30 00 04 30 e1 b4 30 97 4d 46   ......0..0..0.MF
115|     16: 14 00 ae 7c 00 00 00 00 00 00 00 03 00 00 43 00   ...|..........C.
116| page 47 offset 188416
117|   2512: 00 00 00 00 00 00 00 00 be 00 00 00 00 00 00 00   ................
118| page 87 offset 352256
119|   2512: 00 00 00 00 00 00 00 00 aa 00 00 00 00 00 00 00   ................
120| end crash-acaae0347204ae.db
121}]} {}
122
123do_catchsql_test 1.1 {
124  PRAGMA cell_size_check = off;
125  DROP INDEX t1x1;
126} {1 {database disk image is malformed}}
127
128do_catchsql_test 1.2 {
129  SELECT sum(s+length(b)) FROM t1 WHERE a IN (110,10,150) AND q IS NULL;
130} {1 {database disk image is malformed}}
131
132do_catchsql_test 1.3 {
133  REINDEX t1;
134} {1 {database disk image is malformed}}
135
136do_catchsql_test 1.4 {
137  PRAGMA integrity_check
138} {1 {database disk image is malformed}}
139
140
141#-------------------------------------------------------------------------
142reset_db
143do_test 2.0 {
144  sqlite3 db {}
145  db deserialize [decode_hexdb {
146| size 20480 pagesize 4096 filename crash.txt.db
147| page 1 offset 0
148|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
149|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 05   .....@  ........
150|     32: 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 04   ................
151|     48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00   ................
152|     96: 00 00 00 00 0d 00 00 00 05 0e 55 00 0f 74 0f 3c   ..........U..t.<
153|    112: 0e f9 0e d1 0e 55 00 00 00 00 00 00 00 00 00 00   .....U..........
154|   3664: 00 00 00 00 00 7a 05 07 15 11 11 08 81 63 76 69   .....z.......cvi
155|   3680: 65 77 76 31 76 31 43 52 45 41 54 45 20 56 49 45   ewv1v1CREATE VIE
156|   3696: 57 20 76 31 28 78 2c 79 29 20 41 53 0a 53 45 4c   W v1(x,y) AS.SEL
157|   3712: 45 43 54 20 74 31 2e 62 2c 74 32 2e 62 20 46 52   ECT t1.b,t2.b FR
158|   3728: 4f 4d 20 74 31 2c 74 32 20 57 48 45 52 45 20 74   OM t1,t2 WHERE t
159|   3744: 31 2e 61 3d 74 32 2e 61 20 47 52 4f 55 50 20 42   1.a=t2.a GROUP B
160|   3760: 59 20 31 20 48 41 56 49 4e 47 20 74 32 2e 63 20   Y 1 HAVING t2.c
161|   3776: 4e 4f 54 20 4e 55 4c 4c 0a 4c 49 4d 49 54 20 31   NOT NULL.LIMIT 1
162|   3792: 30 26 04 06 17 11 11 01 39 74 61 62 6c 65 74 32   0&......9tablet2
163|   3808: 74 32 05 43 52 45 41 54 45 20 54 41 42 4c 45 20   t2.CREATE TABLE
164|   3824: 74 32 28 61 2c 62 2c 63 29 41 03 06 17 15 11 01   t2(a,b,c)A......
165|   3840: 6b 69 6e 64 65 78 74 31 78 31 74 31 04 43 52 45   kindext1x1t1.CRE
166|   3856: 41 54 45 20 49 4e 44 45 58 20 73 31 78 31 20 4f   ATE INDEX s1x1 O
167|   3872: 4e 20 74 31 28 64 29 20 57 48 45 52 45 20 65 65   N t1(d) WHERE ee
168|   3888: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 36 02 06 17    IS NOT NULL6...
169|   3904: 17 11 01 53 69 6e 64 65 78 74 31 61 62 63 74 31   ...Sindext1abct1
170|   3920: 03 43 52 45 41 54 45 20 49 4e 44 45 58 20 74 31   .CREATE INDEX t1
171|   3936: 61 62 63 20 4f 4e 20 74 31 28 61 2c 62 2c 63 2b   abc ON t1(a,b,c+
172|   3952: 64 2b 65 29 81 09 01 07 17 11 11 01 81 7d 74 61   d+e)..........ta
173|   3968: 62 6c 65 74 31 74 31 02 43 52 45 41 54 45 20 54   blet1t1.CREATE T
174|   3984: 41 42 4c 45 20 74 31 28 61 2c 62 2c 63 2c 64 2c   ABLE t1(a,b,c,d,
175|   4000: 65 2c 66 2c 67 2c 68 2c 6a 2c 6a 6a 2c 6a 6a 6a   e,f,g,h,j,jj,jjj
176|   4016: 2c 6b 2c 61 61 2c 62 62 2c 63 63 2c 64 64 2c 65   ,k,aa,bb,cc,dd,e
177|   4032: 65 20 44 45 46 41 55 4c 54 20 33 2e 31 34 2c 0a   e DEFAULT 3.14,.
178|   4048: 66 66 20 44 45 46 41 55 4c 54 28 27 68 69 63 63   ff DEFAULT('hicc
179|   4064: 75 70 27 29 2c 67 67 20 4e 4f 54 20 4e 55 4c 4c   up'),gg NOT NULL
180|   4080: 20 44 45 46 41 55 4c 54 28 66 61 6c 73 65 29 29    DEFAULT(false))
181| page 2 offset 4096
182|      0: 0d 00 00 00 0a 0e 7b 00 0f dc 0f b6 0f 8f 0f 68   ...............h
183|     16: 0f 41 0f 1a 0e f3 0e cb 0e a3 0e 7b 00 00 00 00   .A..............
184|   3696: 00 00 00 00 00 00 00 00 00 00 00 26 0a 14 01 01   ...........&....
185|   3712: 02 08 00 00 00 00 00 00 00 00 00 00 00 00 07 19   ................
186|   3728: 08 09 5a 00 b4 40 09 1e b8 51 eb 85 1f 68 69 63   [email protected]
187|   3744: 63 75 70 26 09 14 01 01 02 08 00 00 00 00 00 00   cup&............
188|   3760: 00 00 00 00 00 00 07 19 08 08 50 00 a0 40 09 1e   ..........P..@..
189|   3776: b8 51 eb 85 1f 68 69 63 63 75 70 26 08 14 01 01   .Q...hiccup&....
190|   3792: 02 08 00 00 00 00 00 00 00 00 00 00 00 00 07 19   ................
191|   3808: 08 07 46 00 8c 40 09 1e b8 51 eb 85 1f 68 69 63   [email protected]
192|   3824: 63 75 70 25 07 14 01 01 01 08 00 00 00 00 00 00   cup%............
193|   3840: 00 00 00 00 00 00 07 b9 08 06 3c 78 40 09 1e b8   ..........<x@...
194|   3856: 51 eb 85 1f 68 69 63 63 75 70 25 06 14 01 00 01   Q...hiccup%.....
195|   3872: 08 00 00 00 00 00 00 00 00 00 00 00 00 07 19 08   ................
196|   3888: 05 32 64 40 09 1e b8 51 eb 85 1f 68 69 63 63 75   [email protected]
197|   3904: 70 25 05 14 01 01 01 08 00 00 00 00 00 00 00 00   p%..............
198|   3920: 00 00 00 00 07 19 08 04 28 50 40 09 1e b8 51 eb   ........([email protected].
199|   3936: 85 1f 68 69 63 63 75 70 25 04 14 01 01 01 08 00   ..hiccup%.......
200|   3952: 00 00 00 00 00 00 00 00 00 00 00 07 19 08 03 1e   ................
201|   3968: 3c 40 09 1e b8 51 eb 85 1f 68 69 63 63 75 70 25   <@...Q...hiccup%
202|   3984: 03 14 01 01 01 08 00 00 00 00 00 00 00 00 00 00   ................
203|   4000: 00 00 07 19 08 02 14 28 40 09 1e b8 51 eb 85 1f   .......(@...Q...
204|   4016: 68 69 63 63 75 70 24 02 14 09 01 01 08 00 00 00   hiccup$.........
205|   4032: 00 00 00 00 00 00 00 00 00 07 19 08 0a 14 40 09   ..............@.
206|   4048: 1e b8 51 eb 85 1f 68 69 63 63 75 70 22 01 14 08   ..Q...hiccup....
207|   4064: 08 08 07 ff ff ff ff ff ff 00 00 00 00 00 00 07   ................
208|   4080: 19 08 40 09 1e b8 51 eb 85 1f 68 69 63 63 75 70   [email protected]
209| page 3 offset 8192
210|      0: 0a 00 00 00 0a 0f aa 00 0f fa 0f f2 0f e9 0f e0   ................
211|     16: 0f d7 0f ce 0f c5 0f bc 0e b3 0f aa 00 00 00 00   ................
212|   4000: 00 00 00 00 00 00 00 00 00 00 08 05 01 01 00 01   ................
213|   4016: 09 5a 0a 08 05 01 01 00 01 08 50 09 08 05 01 01   .Z........P.....
214|   4032: 00 01 07 46 08 08 05 01 01 00 01 06 3c 07 08 05   ...F........<...
215|   4048: 01 01 00 01 05 32 06 08 05 01 01 00 01 04 28 05   .....2........(.
216|   4064: 08 05 01 01 00 01 03 1e 04 08 05 01 01 00 01 02   ................
217|   4080: 14 03 07 05 09 01 00 01 0a 02 05 05 08 08 00 09   ................
218| page 4 offset 12288
219|      0: 0a 00 00 00 0a 0f cf 00 0f fc 0f f7 0f f2 0f ed   ................
220|     16: 0f e8 0f e3 0f de 0f d9 0f d4 0f cf 00 00 00 00   ................
221|   4032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04   ................
222|   4048: 03 08 01 0a 04 03 08 01 09 04 03 08 01 08 04 03   ................
223|   4064: 08 01 07 04 03 08 01 06 04 03 08 01 05 04 03 08   ................
224|   4080: 01 04 04 03 08 01 13 04 03 08 01 02 03 03 08 09   ................
225| page 5 offset 16384
226|      0: 0d 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00   ................
227| end crash.txt.db
228}]} {}
229
230do_execsql_test 2.1 {
231  PRAGMA writable_schema=ON; -- bypass improved sqlite_master consistency checking
232  INSERT INTO t1(b) VALUES(X'a0fee3669f9fddefc5cba913e4225d4b6ce2b04f26b87fad3ee6f9b7d90a1ea62a169bf41e5d32707a6ca5c3d05e4bde05c9d89eaaa8c50e74333d2e9fcd7dfe95528a3a016aac1102d825c5cd70cf99d8a88e0ea7f798d4334386518b7ad359beb168b93aba059a2a3bd93112d65b44c12b9904ea786b204d80531cdf0504bf9b203dbe927061974caf7b9f30cbc3397b61f802e732012a6663d41c3607d6f1c0dbcfd489adac05ca500c0b04439d894cd93a840159225ef73b627e178b9f84b3ffe66cf22a963a8368813ff7961fc47f573211ccec95e0220dcbb3bf429f4a50ba54d7a53784ac51bfef346e6ac8ae0d0e7c3175946e62ba2b');
233}
234
235do_catchsql_test 2.2 {
236  SELECT b,c FROM t1 ORDER BY a;
237} {1 {database disk image is malformed}}
238
239#-------------------------------------------------------------------------
240reset_db
241do_execsql_test 3.0 {
242  CREATE TABLE t1(a, b, c, d INTEGER PRIMARY KEY);
243  CREATE TABLE t2(a, b, c, d INTEGER PRIMARY KEY);
244
245  INSERT INTO t1(a, b, c, d) VALUES (1, 2, 3, 100), (4, 5, 6, 101);
246  INSERT INTO t2(a, b, c, d) VALUES (1, 100, 3, 1000), (4, 101, 6, 1001);
247
248  CREATE INDEX t1a ON t1(a);
249  CREATE INDEX t2a ON t2(a, b, c);
250
251  PRAGMA writable_schema = 1;
252  UPDATE sqlite_master SET sql = 'CREATE INDEX t2a ON t2(a)' WHERE name='t2a';
253}
254
255db close
256sqlite3 db test.db
257
258do_catchsql_test 3.1 {
259  INSERT INTO t1 SELECT * FROM t2;
260} {1 {database disk image is malformed}}
261
262#-------------------------------------------------------------------------
263reset_db
264do_test 4.0 {
265  sqlite3 db {}
266  db deserialize [decode_hexdb {
267| size 4096 pagesize 512 filename crash-6b48ba69806134.db
268| page 1 offset 0
269|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
270|     16: 02 00 01 01 00 40 20 20 00 ff ff ff ff 00 00 07   .....@  ........
271|     32: 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 04   ................
272|     48: 00 00 00 00 00 00 00 05 00 eb 00 01 00 00 00 00   ................
273|     80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c   ................
274|     96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0   ..,P............
275|    112: 05 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00   .V...*..........
276|    128: 00 ff 00 00 ff ff ff e1 00 00 00 00 00 00 00 00   ................
277|    144: 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00   ................
278|    160: 00 00 00 00 00 00 00 00 f2 00 00 00 00 00 00 00   ................
279|    176: 00 00 f9 ff ff ff ff ff ff ff 00 00 00 00 00 fb   ................
280|    208: 00 00 00 00 00 00 00 00 1e 00 00 00 fe 00 00 00   ................
281|    224: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ca 00   ................
282|    256: 00 00 00 00 ef ff 22 07 06 17 11 11 01 31 74 61   .............1ta
283|    272: 62 6c 65 74 38 38 74 04 43 52 45 41 54 45 20 54   blet88t.CREATE T
284|    288: 41 42 4c 45 20 74 34 28 87 29 2a 06 06 17 13 11   ABLE t4(.)*.....
285|    304: 01 3f 69 4f 64 65 78 74 33 78 74 33 05 43 52 45   .?iOdext3xt3.CRE
286|    320: 41 54 45 20 49 6e 44 45 58 20 74 33 78 20 4f 4e   ATE InDEX t3x ON
287|    336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e    t3(x).......Ein
288|    352: 64 65 2e 74 32 63 64 74 3d 05 43 52 45 41 54 45   de.t2cdt=.CREATE
289|    368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74    INDEX t2cd ON t
290|    384: 32 28 0a 0c 44 29 28 05 06 17 11 11 01 3d 74 61   2(..D)(......=ta
291|    400: 62 6c 65 d4 33 74 33 04 43 52 45 41 54 45 20 54   ble.3t3.CREATE T
292|    416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29   ABLE t3(c,x,e,f)
293|    432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74   (......=tablet2t
294|    448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74   2.CREATE TABLE t
295|    464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11   2(c,d,e,f)$.....
296|    480: 01 35 74 60 62 6c 65 74 31 74 31 02 43 52 45 41   .5t`blet1t1.CREA
297|    496: 54 45 20 54 41 42 4c 45 20 74 30 28 61 2c 62 29   TE TABLE t0(a,b)
298| page 2 offset 512
299|      0: 0d 00 ff 11 04 01 cf 00 01 fa 01 f3 01 de 01 cf   ................
300|     32: 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 13   ................
301|     48: 00 00 00 00 00 00 00 00 00 00 00 01 00 20 00 00   ............. ..
302|     64: 00 00 00 00 00 00 f8 ff ff ff 00 00 00 00 00 00   ................
303|    160: 01 64 00 00 00 00 00 80 ff ff ff 00 00 00 00 00   .d..............
304|    176: 00 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 03   ................
305|    192: 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00   ..@.............
306|    288: 00 00 00 00 00 00 ff ff ff e9 00 00 00 00 00 00   ................
307|    336: 01 00 00 ff ff 00 00 00 00 00 00 00 00 00 00 00   ................
308|    368: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ...............
309|    384: 00 de ff 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
310|    464: 00 00 00 00 00 13 76 65 6e 65 69 67 68 74 13 03   ......veneight..
311|    480: 03 40 07 07 14 00 54 45 20 49 4e 44 45 58 20 74   [email protected] INDEX t
312|    496: 32 63 64 20 4f 4e 20 74 32 28 0a 0c 44 09 01 02   2cd ON t2(..D...
313| page 3 offset 1024
314|      0: 0d 00 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 aa   ....H.T.........
315|     16: 30 34 28 87 29 2a 06 06 17 13 11 01 3f 69 4f 64   04(.)*......?iOd
316|     32: 65 79 74 33 78 74 33 6d 6d 6d 6d 6d 6d 7d 6d 6d   eyt3xt3mmmmmm.mm
317|     48: 6d 41 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d   mAmmmmmmmmmmmmmm
318|     64: 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 66 6d 6d 6d 6d   mmmmmmmmmmmfmmmm
319|     80: 6d 4e 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d   mNmmmmmmmmmmmmmm
320|     96: 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d   mmmmmmmmmmmmmmmm
321|    112: 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d   mmmmmmmmmmmmmmmm
322|    128: 6d 6d 6d 6d 6d 00 00 00 00 00 00 00 00 00 00 00   mmmmm...........
323|    160: 80 00 00 00 00 00 00 03 00 00 00 ff e4 00 00 00   ................
324|    208: 00 00 00 00 00 00 00 00 00 00 00 00 00 c5 00 00   ................
325|    240: 14 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00   ................
326|    256: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0f ec   ................
327|    304: 00 00 00 00 19 08 05 17 17 17 17 65 69 67 68 74   ...........eight
328|    320: 65 69 67 68 74 73 65 00 00 00 00 00 00 00 00 00   eightse.........
329|    336: 00 00 00 00 19 08 05 17 17 17 17 65 69 67 68 74   ...........eight
330|    352: 65 69 67 68 74 73 65 01 65 6e 00 00 00 10 25 07   eightse.en....%.
331|    368: 07 6e 25 07 07 07 40 18 00 00 00 00 00 00 40 18   .n%...@.......@.
332|    384: 00 00 00 00 00 00 40 14 00 00 00 00 00 00 40 14   ......@.......@.
333|    400: 00 00 00 00 00 00 09 06 05 01 01 01 01 04 04 03   ................
334|    416: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17   ................
335|    432: 17 10 65 76 65 6e 65 69 67 68 74 65 69 67 68 74   ..eveneighteight
336|    448: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00   seven%......@...
337|    464: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00   ....@.......@...
338|    480: 00 00 00 00 40 14 00 00 00 00 e8 f6 09 02 00 00   ....@...........
339|    496: 00 00 00 00 00 00 00 00 00 00 64 00 00 00 00 02   ..........d.....
340| page 4 offset 1536
341|      0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 fa   ................
342|     16: 1f a1 07 00 00 00 00 00 01 00 00 00 00 00 00 00   ................
343|     32: 00 00 00 00 00 00 00 00 00 00 00 00 00 73 69 6d   .............sim
344|     48: 70 6c 65 00 00 00 00 00 00 00 00 00 00 00 00 00   ple.............
345|     80: 00 00 00 00 00 10 00 00 00 00 00 00 01 00 00 00   ................
346|     96: 00 00 00 00 00 00 00 00 00 00 00 00 00 fe ff ff   ................
347|    112: ff 00 00 00 00 00 00 00 00 00 00 00 4a 00 00 00   ............J...
348|    144: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00   ................
349|    176: e5 ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00   ................
350|    208: 00 00 00 00 00 00 00 00 00 00 36 36 00 00 00 00   ..........66....
351|    240: 00 00 00 6c 00 00 00 00 00 00 00 00 00 00 00 00   ...l............
352|    256: 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
353|    320: 00 00 00 00 00 00 00 00 01 00 00 02 00 80 00 00   ................
354|    336: 00 00 00 00 00 19 08 05 17 17 17 17 65 69 67 68   ............eigh
355|    352: 74 65 69 67 68 74 73 65 76 65 6e 73 65 76 65 6e   teightsevenseven
356|    368: 25 07 05 07 07 07 07 40 18 00 00 00 00 00 00 40   %......@.......@
357|    384: 18 00 20 00 00 00 40 00 14 00 00 00 00 00 00 40   .. ...@........@
358|    400: 14 00 00 00 00 00 1c 09 06 05 01 01 01 01 04 04   ................
359|    416: 03 03 07 05 05 01 01 00 00 00 00 00 00 00 00 00   ................
360|    448: 74 73 65 76 65 6e 00 80 ff ff 00 00 00 00 00 aa   tseven..........
361|    464: 00 9e 00 00 00 00 00 00 00 00 00 00 00 70 6f 72   .............por
362|    480: 74 65 72 00 00 00 00 00 00 00 00 00 00 00 00 00   ter.............
363|    496: 00 00 00 00 00 00 29 00 00 00 00 00 00 00 00 00   ......).........
364| page 5 offset 2048
365|      0: 0a 00 00 00 08 01 96 00 01 fa 01 c5 01 f2 01 bc   ................
366|     16: 01 dc 01 a6 01 96 01 cc 00 00 00 00 00 00 00 00   ................
367|    112: 00 00 00 09 00 00 00 00 01 00 00 00 00 00 00 00   ................
368|    160: 74 72 69 67 62 ff ff ff ff fc 00 00 00 00 00 00   trigb...........
369|    240: 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 00 00   ................
370|    256: e5 ff ff ff 00 00 54 00 00 00 00 00 00 00 00 00   ......T.........
371|    304: 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00 00   ................
372|    400: 00 00 00 00 00 09 00 00 00 00 01 00 00 00 00 00   ................
373|    448: 00 00 74 72 69 67 62 ff ff ff ff fc 00 00 07 05   ..trigb.........
374|    464: 05 01 01 09 09 02 02 19 04 05 17 17 17 17 10 65   ...............e
375|    480: 76 65 6e 65 69 67 68 74 65 40 18 00 00 00 00 01   veneighte@......
376|    496: 02 03 07 04 01 01 01 03 04 02 05 04 09 01 ff fd   ................
377| end crash-6b48ba69806134.db
378}]} {}
379
380do_catchsql_test 4.1 {
381  PRAGMA writable_schema=ON; -- bypass improved sqlite_master consistency checking
382  INSERT INTO t3 SELECT * FROM t2;
383} {1 {database disk image is malformed}}
384
385
386#-------------------------------------------------------------------------
387reset_db
388do_test 5.0 {
389  sqlite3 db {}
390  db deserialize [decode_hexdb {
391| size 192512 pagesize 4096 filename crash-9ae5502296c949.db
392| page 1 offset 0
393|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
394|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 2f   .....@  ......./
395|     32: 00 00 00 1b 00 00 00 13 00 00 00 03 00 00 00 04   ................
396|     48: 00 00 00 00 00 00 00 06 00 00 00 01 00 00 00 00   ................
397|     64: 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00   ................
398|     96: 00 00 00 00 0d 00 00 00 04 0e e2 00 0f 96 0f 44   ...............D
399|    112: 0f 10 0e e2 00 00 00 00 00 00 00 00 00 00 00 00   ................
400|   3808: 00 00 2c 04 06 17 15 11 01 41 69 6e 64 65 78 74   ..,......Aindext
401|   3824: 31 78 32 74 31 06 43 52 45 41 54 45 20 49 4e 44   1x2t1.CREATE IND
402|   3840: 45 58 20 74 31 78 32 20 4f 4e 20 74 31 28 62 29   EX t1x2 ON t1(b)
403|   3856: 32 03 06 17 15 11 01 4d 69 6e 64 65 78 74 31 78   2......Mindext1x
404|   3872: 31 74 31 05 43 52 45 41 54 45 20 49 4e 44 45 58   1t1.CREATE INDEX
405|   3888: 20 74 31 78 31 20 4f 4e 20 74 31 28 67 2b 68 2c    t1x1 ON t1(g+h,
406|   3904: 6a 2c 6b 29 50 02 06 17 2b 2b 01 59 74 61 62 6c   j,k)P...++.Ytabl
407|   3920: 65 73 71 6c 69 74 65 5f 73 65 71 75 65 6e 63 65   esqlite_sequence
408|   3936: 73 71 6c 69 74 65 5f 73 65 71 75 65 6e 63 65 04   sqlite_sequence.
409|   3952: 43 52 45 41 54 45 20 54 41 42 4c 45 20 73 71 6c   CREATE TABLE sql
410|   3968: 69 74 65 5f 73 65 71 75 65 6e 63 65 28 6e 61 6d   ite_sequence(nam
411|   3984: 65 2c 73 65 71 29 68 01 07 17 11 11 01 81 3b 74   e,seq)h.......;t
412|   4000: 61 62 6c 65 74 31 74 31 03 43 52 45 41 54 45 20   ablet1t1.CREATE
413|   4016: 54 41 42 4c 45 20 74 31 28 61 20 49 4e 54 45 47   TABLE t1(a INTEG
414|   4032: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41   ER PRIMARY KEY A
415|   4048: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 62 2c   UTOINCREMENT,.b,
416|   4064: 63 2c 64 2c 65 2c 66 2c 67 2c 68 2c 6a 2c 6b 2c   c,d,e,f,g,h,j,k,
417|   4080: 6c 2c 6d 2c 6e 2c 6f 2c 70 2c 71 2c 72 2c 73 29   l,m,n,o,p,q,r,s)
418| page 2 offset 4096
419|      0: 01 00 00 00 00 01 00 00 00 00 01 00 00 00 00 01   ................
420|     16: 00 00 00 00 02 10 00 00 00 05 00 00 00 03 02 00   ................
421|     32: 00 00 00 05 00 00 00 03 02 00 00 00 00 05 00 00   ................
422|     48: 00 03 02 00 00 00 00 05 00 00 00 03 02 00 00 00   ................
423|     64: 00 05 00 00 00 03 02 00 00 00 00 05 00 00 00 03   ................
424|     80: 02 00 00 00 00 05 00 00 00 03 02 00 00 00 00 05   ................
425|     96: 00 00 00 03 02 00 00 00 00 05 00 00 00 03 05 00   ................
426|    112: 00 00 03 03 00 00 00 23 02 00 00 00 00 03 00 00   .......#........
427|    128: 00 23 02 00 00 00 00 03 00 00 00 23 02 00 00 00   .#.........#....
428|    144: 00 03 00 00 00 23 02 00 00 00 00 03 00 00 00 23   .....#.........#
429|    160: 05 00 00 00 06 05 00 00 00 06 02 00 00 00 00 03   ................
430|    176: 00 00 00 06 02 00 00 00 00 03 00 00 00 24 02 00   .............$..
431|    192: 00 00 00 03 00 00 00 24 02 00 00 00 00 03 00 00   .......$........
432|    208: 00 24 02 00 00 00 00 02 00 00 00 00 03 00 00 00   .$..............
433|    224: 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   $...............
434| page 3 offset 8192
435|      0: 05 00 00 00 09 0f d0 00 00 00 00 19 0f fb 0f f6   ................
436|     16: 0f f1 0f ec 0f e7 0f e2 0f dc 0f d6 0f d0 0f a0   ................
437|     32: 0f a0 0f a0 0f a0 0f a0 0f a0 0f a0 0f a0 0f a0   ................
438|   1072: 00 97 4c 0a 14 00 ae 7c 00 00 00 00 00 00 00 00   ..L....|........
439|   1088: 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00   ................
440|   4000: 0f ac 00 06 00 00 00 00 00 30 00 00 00 00 00 00   .........0......
441|   4048: 00 00 00 16 81 2a 00 00 00 14 81 16 00 00 00 12   .....*..........
442|   4064: 81 02 00 00 00 10 6e 00 00 00 0e 5a 00 00 00 0c   ......n....Z....
443|   4080: 46 00 00 00 0a 32 00 00 00 08 1e 00 00 00 18 0a   F....2..........
444| page 4 offset 12288
445|      0: 0d 00 00 00 01 0f f7 00 0f f7 00 00 00 00 00 00   ................
446|   4080: 00 00 00 00 00 00 00 07 01 03 11 02 74 31 00 be   ............t1..
447| page 5 offset 16384
448|      0: 0a 0f 7c 00 0a 0f 74 00 0f f9 0f eb 0f dd 0f cf   ..|...t.........
449|     16: 0f c1 0f b3 0f a4 0f 94 0f 84 0f 74 0f 74 0f 74   ...........t.t.t
450|     32: 0f 74 0f 74 0f 74 0f 74 0f 74 0f 74 0f 74 00 00   .t.t.t.t.t.t.t..
451|   3952: 00 00 00 00 07 05 00 00 00 02 00 be 0f 8c 00 08   ................
452|   3968: 00 00 00 00 07 05 00 00 00 02 00 aa 0f 9c 00 08   ................
453|   3984: 00 00 00 00 07 05 00 00 00 02 00 96 0f ac 00 08   ................
454|   4000: 00 00 00 00 07 05 00 00 00 02 00 82 0f ba 00 07   ................
455|   4016: 00 00 00 06 05 00 00 00 01 6e 0f c8 00 07 00 00   .........n......
456|   4032: 00 06 05 00 00 00 01 5a 0f d6 00 07 00 00 00 06   .......Z........
457|   4048: 05 00 00 00 01 46 0f e4 00 07 00 00 00 06 05 00   .....F..........
458|   4064: 00 00 01 32 0f f2 00 07 00 00 00 06 05 00 00 00   ...2............
459|   4080: 01 1e 00 00 00 07 00 00 00 06 05 00 00 00 01 0a   ................
460| page 6 offset 20480
461|      0: 02 00 00 00 01 0e 0d 00 00 00 00 24 0e 0d 0c 1a   ...........$....
462|     16: 06 55 04 66 02 77 00 88 00 00 00 00 00 00 00 00   .U.f.w..........
463|    128: 00 00 00 00 00 00 00 00 97 3d 04 ae 7c 01 00 00   .........=..|...
464|    624: 00 00 00 00 00 00 21 97 3d 04 ae 7c 01 00 00 00   ......!.=..|....
465|   1120: 00 00 00 00 00 20 97 3d 04 ae 7c 01 00 00 00 00   ..... .=..|.....
466|   1616: 00 00 00 00 1f 97 3d 04 ae 7c 01 00 00 00 00 00   ......=..|......
467|   2112: 00 00 00 1e 97 3d 04 ae 7c 01 00 00 00 00 00 00   .....=..|.......
468|   2608: 00 00 1d 97 3d 04 ae 7c 01 00 00 00 00 00 00 00   ....=..|........
469|   3088: 00 00 00 00 00 00 00 00 00 00 00 00 01 f3 00 00   ................
470|   3600: 23 97 3d 04 ae 7c 01 00 00 00 00 00 00 00 00 00   #.=..|..........
471|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 26   ...............&
472| page 8 offset 28672
473|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
474|   1072: 97 4d 1e 14 00 ae 7c 00 00 00 00 00 00 00 00 00   .M....|.........
475|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
476|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03   ................
477| page 10 offset 36864
478|    256: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
479|   1072: 97 4d 32 14 00 ae 7c 00 00 00 00 00 00 00 00 00   .M2...|.........
480|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
481|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05   ................
482| page 12 offset 45056
483|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
484|   1072: 97 4d 46 14 00 ae 7c 00 00 00 00 00 00 00 00 00   .MF...|.........
485|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
486|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07   ................
487| page 14 offset 53248
488|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
489|   1072: 97 4d 5a 14 00 ae 7c 00 00 00 00 00 00 00 00 00   .MZ...|.........
490|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
491|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09   ................
492| page 16 offset 61440
493|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
494|   1072: 97 4d 6e 14 00 ae 7c 00 00 00 00 00 00 00 00 00   .Mn...|.........
495|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
496|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0b   ................
497| page 18 offset 69632
498|      0: 0d 00 00 00 01 04 2f 00 04 2f 00 00 00 00 00 00   ....../../......
499|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
500|   1072: 4d 81 02 14 00 ae 7c 00 00 00 00 00 00 00 00 00   M.....|.........
501|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
502|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d   ................
503| page 20 offset 77824
504|      0: 0d 00 00 00 01 04 2f 00 04 2f 00 00 00 00 00 00   ....../../......
505|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
506|   1072: 4d 81 16 14 00 ae 7c 00 00 00 00 00 00 00 00 00   M.....|.........
507|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
508|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0f   ................
509| page 22 offset 86016
510|      0: 0d 00 00 00 01 04 2f 00 04 2f 00 00 00 00 00 00   ....../../......
511|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
512|   1072: 4d 81 2a 14 00 ae 7c 00 00 00 00 00 00 00 00 00   M.*...|.........
513|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
514|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 11   ................
515| page 24 offset 94208
516|      0: 0d 00 00 00 01 04 31 00 04 31 00 00 00 00 00 00   ......1..1......
517|   1072: 00 97 4c 0a 14 00 ae 7c 00 00 00 00 00 00 00 00   ..L....|........
518|   1088: 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00   ................
519| page 25 offset 98304
520|      0: 0d 00 00 00 01 04 2f 00 04 2f 00 00 00 00 00 00   ....../../......
521|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
522|   1072: 4d 81 3e 14 00 ae 7c 00 00 00 00 00 00 00 00 00   M.>...|.........
523|   1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00   ................
524|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13   ................
525| page 26 offset 102400
526|   2512: 00 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 00   ................
527| page 27 offset 106496
528|      0: 00 00 00 00 00 00 00 12 00 00 00 07 00 00 00 1d   ................
529|     16: 00 00 00 09 00 00 00 1f 00 00 00 0b 00 00 00 21   ...............!
530|     32: 00 00 00 0d 00 00 00 25 00 00 00 0f 00 00 00 19   .......%........
531|     48: 00 00 00 11 00 00 00 29 00 00 00 13 00 00 00 2b   .......).......+
532|     64: 00 00 00 15 00 00 00 2d 00 00 00 2e 00 00 00 17   .......-........
533| page 28 offset 110592
534|   2512: 00 00 00 00 00 00 00 1e 00 00 00 00 00 00 00 00   ................
535| page 30 offset 118784
536|   2512: 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00   .......2........
537| page 32 offset 126976
538|   2512: 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00   .......F........
539| page 34 offset 135168
540|   2512: 00 00 00 00 00 00 00 5a 00 00 00 00 00 00 00 00   .......Z........
541| page 35 offset 139264
542|      0: 0a 08 44 00 05 02 77 00 0e 11 0a 33 06 55 02 77   ..D...w....3.U.w
543|     16: 04 66 00 88 00 88 00 88 00 00 00 00 00 00 00 00   .f..............
544|    128: 00 00 00 00 00 00 00 00 04 66 01 ef 00 00 00 00   .........f......
545|    624: 00 00 00 00 00 00 00 97 3d 04 ae 7c 01 00 00 00   ........=..|....
546|   1120: 00 00 00 00 00 20 97 3d 04 ae 7c 01 00 00 00 00   ..... .=..|.....
547|   1616: 00 00 00 00 22 97 3d 04 ae 7c 01 00 00 00 00 00   ......=..|......
548|   2112: 00 00 00 1e 0c 22 01 ef 00 00 00 00 00 00 00 00   ................
549|   2608: 00 00 00 97 3d 04 ae 7c 01 00 00 00 00 00 00 00   ....=..|........
550|   3104: 00 1c 00 00 01 ef 00 00 00 00 00 00 00 00 00 00   ................
551|   3600: 00 97 3d 04 ae 7c 01 00 00 00 00 00 00 00 00 00   ..=..|..........
552|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1a   ................
553| page 36 offset 143360
554|      0: 0a 08 44 00 04 02 77 00 06 55 02 77 04 66 0e 11   ..D...w..U.w.f..
555|     16: 00 88 00 88 00 88 0e 11 00 00 00 00 00 00 00 00   ................
556|    128: 00 00 00 00 00 00 00 00 04 76 01 ef 00 00 00 00   .........v......
557|    624: 00 00 00 00 00 00 00 97 3e 04 ae 7c 02 00 00 00   ........>..|....
558|   1120: 00 00 00 00 00 2a 97 3e 04 ae 7c 02 00 00 00 00   .....*.>..|.....
559|   1616: 00 00 00 00 2c 97 3e 04 ae 7c 02 00 00 00 00 00   ....,.>..|......
560|   2112: 00 00 00 28 00 00 05 cd 00 00 00 00 00 00 00 00   ...(............
561|   3600: 00 97 3e 04 ae 7c 02 00 00 00 00 00 00 00 00 00   ..>..|..........
562|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2f   .............../
563| page 38 offset 151552
564|   2512: 00 00 00 00 00 00 00 6e 00 00 00 00 00 00 00 00   .......n........
565| page 40 offset 159744
566|   2512: 00 00 00 00 00 00 00 00 82 00 00 00 00 00 00 00   ................
567| page 42 offset 167936
568|   2512: 00 00 00 00 00 00 00 00 96 00 00 00 00 00 00 00   ................
569| page 44 offset 176128
570|   2512: 00 00 00 00 00 00 00 00 aa 00 00 00 00 00 00 00   ................
571| page 47 offset 188416
572|   2512: 00 00 00 00 00 00 00 00 be 00 00 00 00 00 00 00   ................
573| end crash-9ae5502296c949.db
574}]} {}
575
576do_catchsql_test 5.1 {
577  INSERT INTO t1(b) VALUES(zeroblob(40000));
578} {1 {database disk image is malformed}}
579
580do_catchsql_test 5.2 {
581  DROP INDEX t1x2;
582} {0 {}}
583
584do_catchsql_test 5.3 {
585  INSERT INTO t1(b) VALUES(zeroblob(40000));
586} {1 {database disk image is malformed}}
587
588#-------------------------------------------------------------------------
589reset_db
590do_test 6.0 {
591  sqlite3 db {}
592  db deserialize [decode_hexdb {
593| size 20480 pagesize 4096 filename crash-d260f001fa015c.db
594| page 1 offset 0
595|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
596|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 05   .....@  ........
597|     32: 00 00 00 00 00 ff ff f0 00 00 00 02 00 00 00 04   ................
598|     48: 00 00 00 00 00 00 00 64 00 00 00 01 00 00 00 00   .......d........
599|     96: 00 00 00 00 0d 0f f8 00 04 0e ce 00 0f 4c 0f d3   .............L..
600|    112: 0e fa 0e ce 00 00 00 00 00 00 00 00 00 00 00 00   ................
601|   3776: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2a 04   ..............*.
602|   3792: 06 17 13 11 01 3f 69 6e 64 65 78 74 31 62 74 31   .....?indext1bt1
603|   3808: 05 43 52 45 41 54 45 20 49 4e 44 45 58 20 74 31   .CREATE INDEX t1
604|   3824: 62 20 4f 4e 20 74 31 28 62 29 50 03 06 17 2b 2b   b ON t1(b)P...++
605|   3840: 01 59 74 61 62 6c 65 73 71 6c 69 74 65 5f 73 65   .Ytablesqlite_se
606|   3856: 71 75 65 6e 63 65 73 71 6c 69 74 65 5f 73 65 71   quencesqlite_seq
607|   3872: 75 65 6e 63 65 04 43 52 45 41 54 45 20 54 41 42   uence.CREATE TAB
608|   3888: 4c 45 20 73 71 6c 69 74 65 5f 73 65 71 75 65 6e   LE sqlite_sequen
609|   3904: 63 65 28 6e 61 6d 65 2c 73 65 71 29 81 04 01 07   ce(name,seq)....
610|   3920: 17 11 11 01 81 73 74 61 62 6c 65 74 31 74 31 02   .....stablet1t1.
611|   3936: 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 31 28   CREATE TABLE t1(
612|   3952: 61 20 52 45 41 4c 20 4e 4f 54 20 4e 55 4c 4c 20   a REAL NOT NULL
613|   3968: 44 45 46 41 55 4c 54 28 32 35 2b 33 32 29 2c 62   DEFAULT(25+32),b
614|   3984: 20 46 4c 4f 41 54 2c 63 20 44 4f 55 42 4c 45 20    FLOAT,c DOUBLE
615|   4000: 55 4e 49 51 55 45 2c 0a 64 20 43 4c 4f 42 2c 65   UNIQUE,.d CLOB,e
616|   4016: 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59    INTEGER PRIMARY
617|   4032: 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45    KEY AUTOINCREME
618|   4048: 4e 54 29 23 02 06 17 37 11 01 00 69 6e 64 65 78   NT)#...7...index
619|   4064: 73 71 6c 69 74 65 5f 61 75 74 6f 69 6e 64 65 78   sqlite_autoindex
620|   4080: 5f 74 31 5f 31 74 31 05 00 00 00 08 00 00 00 00   _t1_1t1.........
621| page 2 offset 4096
622|      0: 0d 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00   ................
623| page 3 offset 8192
624|      0: 0a 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00   ................
625| page 4 offset 12288
626|      0: 0d 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00   ................
627| page 5 offset 16384
628|      0: 0a 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00   ................
629| end crash-d260f001fa015c.db
630}]} {}
631
632do_catchsql_test 6.1 {
633  BEGIN;
634    INSERT INTO t1(b) VALUES(1);
635    INSERT INTO t1(b) VALUES(2);
636  COMMIT;
637} {1 {malformed database schema (t1b) - invalid rootpage}}
638
639#-------------------------------------------------------------------------
640reset_db
641do_test 7.0 {
642  sqlite3 db {}
643  db deserialize [decode_hexdb {
644| size 20480 pagesize 4096 filename crash-8391315d75edff.db
645| page 1 offset 0
646|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
647|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 05   .....@  ........
648|     32: 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 04   ................
649|     48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00   ................
650|     96: 00 00 00 00 0d 00 00 00 05 0e 55 00 0f 74 0f 3c   ..........U..t.<
651|    112: 0e f9 0e d1 0e 55 00 00 00 00 00 00 00 00 00 00   .....U..........
652|   3664: 00 00 00 00 00 7a 05 07 15 11 11 08 81 63 76 69   .....z.......cvi
653|   3680: 65 77 76 31 76 31 43 52 45 41 54 45 20 56 49 45   ewv1v1CREATE VIE
654|   3696: 57 20 76 31 28 78 2c 69 29 20 41 53 0a 53 45 4c   W v1(x,i) AS.SEL
655|   3712: 45 43 54 20 74 31 2e 62 2c 74 32 2e 62 20 46 52   ECT t1.b,t2.b FR
656|   3728: 4f 4d 20 74 31 2c 74 32 20 57 48 45 52 45 20 74   OM t1,t2 WHERE t
657|   3744: 31 2e 61 3d 74 32 2e 61 20 47 52 4f 55 50 20 42   1.a=t2.a GROUP B
658|   3760: 59 20 31 20 48 41 56 49 4e 47 20 74 32 2e 63 20   Y 1 HAVING t2.c
659|   3776: 4e 4f 54 20 4e 55 4c 4c 0a 4c 49 4d 49 54 20 31   NOT NULL.LIMIT 1
660|   3792: 30 26 04 06 17 11 11 01 39 74 61 62 6c 65 74 32   0&......9tablet2
661|   3808: 74 32 05 43 52 45 41 54 45 20 54 41 42 4c 45 20   t2.CREATE TABLE
662|   3824: 74 32 28 61 2c 62 2c 63 29 41 03 06 17 15 11 01   t2(a,b,c)A......
663|   3840: 6b 69 6e 64 65 78 74 31 78 31 74 31 03 43 52 45   kindext1x1t1.CRE
664|   3856: 41 54 45 20 49 4e 44 45 58 20 74 31 78 31 20 4f   ATE INDEX t1x1 O
665|   3872: 4e 20 74 31 28 64 29 20 57 48 45 52 45 20 65 65   N t1(d) WHERE ee
666|   3888: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 36 02 06 17    IS NOT NULL6...
667|   3904: 17 11 01 53 69 6e 64 65 78 74 31 61 62 63 74 31   ...Sindext1abct1
668|   3920: 03 43 52 45 41 54 45 20 49 4e 44 45 58 20 74 31   .CREATE INDEX t1
669|   3936: 61 62 63 20 4f 4e 20 74 31 28 61 2c 62 2c 63 2b   abc ON t1(a,b,c+
670|   3952: 64 2b 65 29 81 09 01 07 17 11 11 01 81 7d 74 61   d+e)..........ta
671|   3968: 62 6c 65 74 31 74 31 02 43 52 45 41 54 45 20 54   blet1t1.CREATE T
672|   3984: 41 42 4c 45 20 74 31 28 61 2c 62 2c 63 2c 64 2c   ABLE t1(a,b,c,d,
673|   4000: 65 2c 66 2c 67 2c 68 2c 6a 2c 6a 6a 2c 6a 6a 6a   e,f,g,h,j,jj,jjj
674|   4016: 2c 6b 2c 61 61 2c 62 69 8c 63 63 2c 64 64 2c 65   ,k,aa,bi.cc,dd,e
675|   4032: 65 20 44 45 46 41 55 4c 54 20 33 2e 31 34 2c 0a   e DEFAULT 3.14,.
676|   4048: 66 66 20 44 45 46 41 55 4c 54 28 27 68 69 63 63   ff DEFAULT('hicc
677|   4064: 75 70 27 29 2c 67 67 20 4e 4f 54 20 4e 55 4c 4c   up'),gg NOT NULL
678|   4080: 20 44 45 46 41 55 4c 54 28 66 61 6c 73 65 29 29    DEFAULT(false))
679| page 2 offset 4096
680|      0: 0d 00 00 00 0a 0e 7b 00 0f dc 0f b6 0f 8f 0f 68   ...............h
681|     16: 0f 41 0f 1a 0e f3 0e cb 0e a3 0e 22 00 00 00 00   .A..............
682|   3696: 00 00 00 00 00 00 00 00 00 00 00 26 0a 14 01 01   ...........&....
683|   3712: 02 08 00 00 00 00 00 00 00 00 00 00 00 00 07 19   ................
684|   3728: 08 09 5a 00 b4 40 09 1e b8 51 eb 95 1f 68 69 63   [email protected]
685|   3744: 63 75 70 26 09 14 01 01 02 08 00 00 00 00 00 00   cup&............
686|   3760: 00 00 00 00 00 00 07 19 08 08 50 00 a0 40 09 1e   ..........P..@..
687|   3776: b8 51 eb 85 1f 68 69 63 63 74 70 26 08 14 01 01   .Q...hicctp&....
688|   3792: 03 08 00 00 00 00 00 00 00 00 00 00 00 00 07 19   ................
689|   3808: 08 07 46 00 8c 40 09 1e b8 51 eb 85 1f 68 69 63   [email protected]
690|   3824: 63 75 70 25 07 14 01 01 01 08 00 00 00 00 00 00   cup%............
691|   3840: 00 00 00 00 00 10 07 19 08 06 3c 78 40 09 1e b8   ..........<x@...
692|   3856: 51 eb 85 1f 68 69 63 63 75 70 25 06 14 01 01 01   Q...hiccup%.....
693|   3872: 08 00 00 00 00 00 00 00 00 00 00 00 00 07 19 08   ................
694|   3888: 05 32 64 40 09 1e b8 51 eb 85 1f 68 69 63 63 75   [email protected]
695|   3904: 70 25 05 14 01 01 01 08 00 00 00 00 00 00 00 00   p%..............
696|   3920: 00 00 00 00 07 19 08 04 28 50 40 09 1e b8 51 eb   ........([email protected].
697|   3936: 85 1f 68 69 63 63 75 70 25 04 14 01 00 f1 08 00   ..hiccup%.......
698|   3952: 00 00 00 00 00 00 00 00 00 00 00 07 19 08 03 1e   ................
699|   3968: 3c 40 09 1e b8 51 eb 85 1f 68 69 63 63 75 70 25   <@...Q...hiccup%
700|   3984: 03 14 01 01 01 08 00 00 00 00 00 00 00 00 00 00   ................
701|   4000: 00 00 07 19 08 02 14 28 40 09 1e b8 51 eb 85 1f   .......(@...Q...
702|   4016: 68 69 63 63 75 70 24 02 14 09 01 01 08 00 00 00   hiccup$.........
703|   4032: 00 00 00 00 00 00 00 00 00 07 19 08 0a 14 40 09   ..............@.
704|   4048: 1e b8 51 eb 85 1f 68 69 63 63 75 70 22 01 14 08   ..Q...hiccup....
705|   4064: 08 08 08 00 00 00 00 00 00 00 00 00 00 00 00 07   ................
706|   4080: 19 08 40 09 1e b8 51 eb 85 1f 68 69 63 63 75 70   [email protected]
707| page 3 offset 8192
708|      0: 0a 00 00 00 0a 0f aa 00 0f fa 0f f2 0f e9 0f e0   ................
709|     16: 0f d7 0f ce 0f c5 0f bc 0f b3 0f aa 00 00 00 00   ................
710|   4000: 00 00 00 00 00 00 00 00 00 00 08 05 01 01 00 01   ................
711|   4016: 09 5a 0a d8 05 01 01 00 01 08 50 09 08 05 01 01   .Z........P.....
712|   4032: 00 01 07 46 08 08 05 01 01 00 01 06 3c 07 08 05   ...F........<...
713|   4048: 01 01 00 01 05 32 06 08 05 01 01 00 01 04 28 05   .....2........(.
714|   4064: 08 05 01 02 60 01 03 1e 04 08 05 01 01 00 01 02   ....`...........
715|   4080: 14 03 07 05 09 01 00 01 0a 02 05 05 08 08 00 09   ................
716| page 4 offset 12288
717|      0: 0a 00 00 00 0a 0f cf 00 0f fc 0f f7 0f f2 0f ed   ................
718|     16: 0f e8 0f e3 0f de 0f d9 0f d4 0f cf 00 00 00 00   ................
719|   4032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04   ................
720|   4048: 03 08 01 0a 04 03 08 01 09 04 03 08 01 08 04 03   ................
721|   4064: 08 01 07 04 03 08 01 06 04 03 08 01 05 04 03 08   ................
722|   4080: 01 04 04 03 08 01 03 04 03 08 01 02 03 03 08 09   ................
723| page 5 offset 16384
724|      0: 0d 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00   ................
725| end crash-8391315d75edff.db
726}]} {}
727
728do_catchsql_test 7.1 {
729  SELECT * FROM sqlite_master;
730} {1 {malformed database schema (t1x1) - invalid rootpage}}
731
732#-------------------------------------------------------------------------
733reset_db
734do_test 8.0 {
735  sqlite3 db {}
736  db deserialize [decode_hexdb {
737| size 2048 pagesize 512 filename a.db
738| page 1 offset 0
739|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
740|     16: 02 00 01 01 00 40 20 20 ff ff 00 0c 00 00 00 07   .....@  ........
741|     32: 0b 00 00 00 00 00 00 00 00 00 00 08 9c 00 00 04   ................
742|     48: 00 00 00 e0 09 00 00 01 00 00 00 01 00 00 00 00   ................
743|     64: 00 00 00 00 f2 ff 00 00 00 00 00 00 00 00 00 00   ................
744|     80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c   ................
745|     96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0   ..,P............
746|    112: 05 56 01 86 01 2a 01 06 00 00 00 00 00 06 00 00   .V...*..........
747|    128: 00 ff 00 00 ff ff ff e1 00 00 00 00 00 00 00 00   ................
748|    144: 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00   ................
749|    160: 00 00 00 00 00 00 00 00 f2 00 00 00 00 00 00 00   ................
750|    176: 00 00 f9 ff ff ff ff ff ff ff 00 00 00 5f 00 fb   ............._..
751|    192: 00 00 00 00 00 00 00 00 00 e1 ff 00 00 00 00 00   ................
752|    208: 00 00 10 00 00 00 00 00 1e 00 00 00 fe 00 00 00   ................
753|    224: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ca 00   ................
754|    240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35   ...............5
755|    256: 00 00 00 00 ef ff 22 07 06 17 11 11 01 30 39 38   .............098
756|    272: 62 6c 65 74 38 38 74 04 43 52 45 41 54 45 20 54   blet88t.CREATE T
757|    288: 41 42 4c 45 20 74 34 28 87 29 2a 06 06 17 13 11   ABLE t4(.)*.....
758|    304: 01 3f 69 4f 64 65 78 74 33 78 74 40 05 43 52 45   [email protected]
759|    320: 41 54 45 20 49 6e 44 45 58 20 74 33 78 20 4f 4e   ATE InDEX t3x ON
760|    336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e    t3(x).......Ein
761|    352: 00 04 00 00 34 63 64 74 3d 05 43 52 45 41 54 45   ....4cdt=.CREATE
762|    368: 20 49 4e 44 45 58 20 63 74 64 32 20 4f 4e 20 74    INDEX ctd2 ON t
763|    384: 32 28 0a 0c 44 29 28 05 06 17 11 11 01 3d 74 6c   2(..D)(......=tl
764|    400: 62 61 d4 65 33 74 33 04 43 52 45 41 54 45 20 54   ba.e3t3.CREATE T
765|    416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29   ABLE t3(c,x,e,f)
766|    432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74   (......=tablet2t
767|    448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74   2.CREATE TABLE t
768|    464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11   2(c,d,e,f)$.....
769|    480: 01 35 74 60 62 6c 65 74 31 74 31 02 43 52 45 41   .5t`blet1t1.CREA
770|    496: 54 45 20 54 41 42 4c 45 20 74 30 28 61 2c 62 29   TE TABLE t0(a,b)
771| page 2 offset 512
772|      0: 0d 00 ff 11 04 01 cf 80 01 fa 01 09 00 de 01 cf   ................
773|     16: 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00   ................
774|     32: 00 00 08 00 00 00 00 00 00 11 00 00 00 00 00 13   ................
775|     48: 00 00 00 00 00 00 00 00 00 00 00 01 00 e0 ff ff   ................
776|     64: ff d2 ff ff ff 00 f8 ff ff ff 00 00 00 00 00 00   ................
777|     80: 00 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
778|     96: 00 00 00 00 ff de 00 00 00 00 00 00 00 00 00 00   ................
779|    112: 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00   .............@..
780|    128: 2a 00 00 00 00 00 00 00 00 f7 00 00 00 00 00 00   *...............
781|    144: 00 00 00 00 00 21 00 00 00 00 00 00 00 00 00 00   .....!..........
782|    160: 01 64 00 00 00 00 04 80 ff ff ff 00 00 00 00 00   .d..............
783|    176: 00 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00   ................
784|    192: 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00   ..@.............
785|    208: b5 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00   .......@........
786|    224: 00 00 00 f6 00 ee ff ff ff 00 00 00 00 00 00 00   ................
787|    272: f2 00 00 00 00 00 00 00 00 00 f9 ff ff ff ff ff   ................
788|    288: ff ff 00 00 00 5f 00 fb 00 00 00 00 00 00 00 00   ....._..........
789|    320: 1e 00 00 00 fe 00 00 00 00 00 00 00 00 00 00 00   ................
790|    336: 00 00 00 00 00 00 ca 00 00 00 00 00 00 00 ff ec   ................
791|    352: 00 00 00 00 00 00 00 32 00 00 00 00 ef ff 22 07   .......2........
792|    368: 06 17 11 11 01 30 74 61 62 6c 65 74 38 38 74 04   .....0tablet88t.
793|    384: 43 52 45 41 54 45 20 54 41 42 4c 45 20 8c cb d7   CREATE TABLE ...
794|    400: 78 d6 d5 f9 f9 17 13 11 01 3f 69 4f 64 65 78 74   x........?iOdext
795|    416: 33 78 74 33 05 43 52 45 41 54 45 26 49 6e 44 45   3xt3.CREATE&InDE
796|    432: 58 20 74 33 78 00 00 00 00 00 00 00 00 00 00 00   X t3x...........
797|    464: 00 00 00 00 00 13 76 65 6e 65 69 67 68 74 13 03   ......veneight..
798|    480: 03 40 07 07 15 00 54 45 20 49 4e 44 45 58 20 74   [email protected] INDEX t
799|    496: 31 63 64 20 4f 4e 20 74 ce d7 f5 f0 44 09 01 02   1cd ON t....D...
800| page 3 offset 1024
801|      0: 0d 00 00 00 48 01 54 00 01 f6 e2 ec 01 c5 01 aa   ....H.T.........
802|     16: 30 34 28 87 29 32 06 f5 16 13 11 01 8e 61 24 64   04(.)2.......a$d
803|     32: 65 78 74 37 78 1f 33 6d 6d 6d 6d 6d 00 00 04 06   ext7x.3mmmmm....
804|     48: 6d 41 6d 6d 6e 6d 6d 00 00 02 00 6d 6d 6d 6d 6d   mAmmnmm....mmmmm
805|     64: 15 11 01 45 45 45 45 45 45 45 45 45 45 45 45 45   ...EEEEEEEEEEEEE
806|     80: 45 45 45 45 45 45 45 45 45 45 45 00 45 63 74 64   EEEEEEEEEEE.Ectd
807|     96: 34 20 4f 4e 20 61 62 6c 5d 74 38 38 74 04 43 52   4 ON abl]t88t.CR
808|    112: 45 41 54 45 20 54 41 42 4c 45 20 74 34 28 87 29   EATE TABLE t4(.)
809|    128: 2a 06 06 13 13 01 00 00 00 4f 64 6e 78 74 33 44   *........Odnxt3D
810|    144: 74 13 05 43 52 45 41 54 45 20 49 6e 44 45 00 00   t..CREATE InDE..
811|    160: 00 00 00 00 00 00 00 f9 ff ff ff ff ff ff ff 00   ................
812|    176: 00 00 5f 00 fb 00 00 2d 00 00 00 00 00 00 00 00   .._....-........
813|    192: 00 00 00 00 00 00 00 00 00 00 00 00 00 1e 00 00   ................
814|    208: 00 fe 00 00 00 00 17 15 11 01 45 69 6e 64 65 2e   ..........Einde.
815|    224: 5b 38 63 64 74 3d 05 43 52 45 41 54 45 20 49 4e   [8cdt=.CREATE IN
816|    240: 44 45 58 20 63 20 64 32 20 4f 4e 20 74 32 28 0a   DEX c d2 ON t2(.
817|    256: 0c 44 32 05 00 10 00 00 11 11 3d 74 6c 62 61 d4   .D2.......=tlba.
818|    272: 65 33 74 33 04 43 52 45 41 54 45 20 54 41 42 4c   e3t3.CREATE TABL
819|    288: 45 20 74 36 ff ff 7f ff 43 52 45 41 54 45 20 49   E t6....CREATE I
820|    304: 73 71 6c 69 74 65 5f 73 65 71 75 65 6e 63 65 28   sqlite_sequence(
821|    320: 0a 0c 44 29 28 05 06 17 11 11 01 3d 74 6c 62 61   ..D)(......=tlba
822|    336: 20 00 00 00 33 04 43 52 45 41 54 45 20 54 41 42    ...3.CREATE TAB
823|    352: 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 28 02   LE t3(c,x,e,f)(.
824|    368: 06 00 00 7f ff 40 41 54 45 20 49 6e 44 45 58 20   .....@ATE InDEX
825|    384: 74 33 78 20 4f 4e 20 74 31 28 78 29 2e 04 06 17   t3x ON t1(x)....
826|    400: 15 11 01 45 69 6e 64 65 2e 74 34 63 64 74 3d 05   ...Einde.t4cdt=.
827|    416: 00 00 00 00 00 00 00 00 00 00 00 4d 00 00 00 00   ...........M....
828|    432: 01 00 00 00 00 00 00 05 00 00 10 00 00 00 00 00   ................
829|    448: 00 01 00 00 00 00 01 00 00 00 00 07 40 14 00 00   ............@...
830|    464: 00 00 21 00 40 18 00 00 00 00 00 00 40 1c 00 00   ..!.@.......@...
831|    480: 00 00 ff ff ff 00 00 00 5f 00 fb 00 00 2d 00 00   ........_....-..
832|    496: 00 00 00 1e 00 00 00 fe 00 00 64 00 00 ff fb 02   ..........d.....
833| page 4 offset 1536
834|      0: 0d 00 39 00 00 02 00 00 00 00 00 00 00 00 00 00   ..9.............
835| end a.db
836}]} {}
837
838
839do_catchsql_test 8.1 {
840  PRAGMA writable_schema=ON; -- bypass improved sqlite_master consistency checking
841  INSERT INTO t3 SELECT * FROM t2;
842} {1 {database disk image is malformed}}
843
844#-------------------------------------------------------------------------
845reset_db
846do_test 9.0 {
847  sqlite3 db {}
848  db deserialize [decode_hexdb {
849| size 8192 pagesize 4096 filename crash-ab10597e4e1c32.db
850| page 1 offset 0
851|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
852|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00   .....@  ........
853|     96: 00 00 00 00 0d 00 00 00 01 0f d6 00 0f d6 00 00   ................
854|   4048: 00 00 00 00 00 00 28 01 06 17 11 11 01 3d 74 61   ......(......=ta
855|   4064: 62 6c 65 74 31 74 31 02 43 52 45 41 54 45 20 54   blet1t1.CREATE T
856|   4080: 41 42 4c 45 20 74 31 28 61 2c 62 2c 63 2c 64 29   ABLE t1(a,b,c,d)
857| page 2 offset 4096
858|      0: 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
859| end crash-ab10597e4e1c32.db
860}]} {}
861
862do_execsql_test 9.1 {
863  SAVEPOINT one;
864}
865do_catchsql_test 9.3 {
866  INSERT INTO t1(b,c) VALUES(5,6);
867} {1 {database disk image is malformed}}
868do_execsql_test 9.3 {
869  ROLLBACK TO one;
870}
871
872#-------------------------------------------------------------------------
873reset_db
874do_test 10.0 {
875  sqlite3 db {}
876  db deserialize [decode_hexdb {
877| size 180224 pagesize 4096 filename crash-41390d95d613b6.db
878| page 1 offset 0
879|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
880|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00   .....@  ........
881|     96: 00 00 00 00 0d 00 00 00 04 0e e2 00 0f 96 0f 44   ...............D
882|    112: 0f 10 0e e2 00 00 00 00 00 00 00 00 00 00 00 00   ................
883|   3808: 00 00 2c 14 06 17 15 11 01 41 69 6e 64 65 78 74   ..,......Aindext
884|   3824: 41 78 33 74 31 06 43 52 45 41 54 45 20 49 4e 44   Ax3t1.CREATE IND
885|   3840: 45 58 20 74 31 78 32 20 4f 4e 20 74 31 28 62 29   EX t1x2 ON t1(b)
886|   3856: 32 03 06 17 15 11 01 4d 69 6e 64 65 78 74 31 88   2......Mindext1.
887|   3872: 31 74 31 05 43 52 45 41 54 45 20 49 4e 44 45 58   1t1.CREATE INDEX
888|   3888: 20 74 31 78 31 20 4f 4e 20 74 31 28 67 2b 68 2c    t1x1 ON t1(g+h,
889|   3904: 6a 2d 6b 29 50 02 06 17 2b 2b 01 59 74 61 62 6c   j-k)P...++.Ytabl
890|   3920: 65 73 71 6c 69 74 65 5e 73 65 71 74 65 6e 63 65   esqlite^seqtence
891|   3936: 73 71 6c 69 74 65 5f 73 65 71 75 65 6e 63 65 04   sqlite_sequence.
892|   3952: 43 52 45 41 54 45 20 54 41 42 4c 45 20 73 71 6c   CREATE TABLE sql
893|   3968: 69 74 65 5f 73 65 71 75 65 6e 63 65 28 6e 61 6d   ite_sequence(nam
894|   3984: 65 2c 73 65 71 29 68 00 07 17 11 11 01 81 3b 74   e,seq)h.......;t
895|   4000: 61 62 6c 65 74 31 74 31 03 43 52 45 41 54 45 20   ablet1t1.CREATE
896|   4016: 54 41 42 4c 45 20 74 31 28 61 20 49 4e 54 45 47   TABLE t1(a INTEG
897|   4032: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41   ER PRIMARY KEY A
898|   4048: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 62 2c   UTOINCREMENT,.b,
899|   4064: 63 2c 64 2c 65 2c 66 2c 67 2c 68 2c 6a 2c 6b 2c   c,d,e,f,g,h,j,k,
900|   4080: 6c 2c 6d 2c 6e 2c 6f 2c 70 2c 71 2c 72 2c 73 29   l,m,n,o,p,q,r,s)
901| page 2 offset 4096
902|      0: 01 00 00 00 00 01 00 00 10 00 01 00 00 00 00 01   ................
903|     16: 00 00 00 00 02 00 0f f0 00 15 00 00 00 03 02 00   ................
904|     32: 00 00 d9 05 00 00 00 03 02 00 00 00 00 05 00 00   ................
905|     48: 10 03 02 00 00 00 00 05 00 00 00 03 02 00 00 00   ................
906|     64: 00 05 00 00 00 02 62 00 00 00 00 05 00 00 00 03   ......b.........
907|     80: 02 00 00 00 00 05 00 00 00 03 02 00 00 00 00 05   ................
908|     96: 00 00 00 03 02 00 00 00 00 05 00 00 00 03 05 00   ................
909|    112: 00 00 03 03 01 00 00 23 02 00 00 4f 00 02 00 00   .......#...O....
910|    128: 10 25 02 00 00 00 00 03 00 00 00 23 02 00 00 00   .%.........#....
911|    144: 00 03 00 00 00 23 02 00 00 00 00 03 00 00 00 23   .....#.........#
912|    160: 05 00 08 90 06 05 00 00 00 06 01 ff 00 00 00 03   ................
913|    176: 00 00 00 06 02 00 00 00 00 02 ff 00 00 00 00 00   ................
914| page 3 offset 8192
915|      0: 05 00 00 00 09 0f d0 00 00 00 00 19 0f fb 0f f6   ................
916|     16: 0f f1 10 ec ec e7 0f e2 0f dc 0f d6 0f 00 00 00   ................
917|   1072: 00 97 4c 0a 24 00 ae 00 00 00 00 00 00 00 00 00   ..L.$...........
918|   4048: 00 00 00 16 83 39 ff ff ff 14 81 16 00 00 00 12   .....9..........
919|   4064: 81 02 00 00 00 10 6e 00 00 00 0e 5a 00 00 00 0c   ......n....Z....
920|   4080: 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   F...............
921| page 4 offset 12288
922|   1072: 97 4d 32 14 00 ae 00 00 00 00 00 00 00 00 00 00   .M2.............
923|   4080: 00 00 00 00 00 00 00 07 01 03 11 02 74 31 00 bd   ............t1..
924| page 5 offset 16384
925|      0: fa 0f 7c 00 0a 0f 74 00 0f f9 0f eb 0f dd 0f cf   ..|...t.........
926|     16: 0f c1 0f b3 0f a4 0e 94 0f 84 0f 74 0f 74 0f 74   ...........t.t.t
927|     32: 0f 74 0f 64 0f 00 00 00 00 00 00 00 00 00 00 00   .t.d............
928|   3952: 00 00 00 00 07 05 00 00 00 02 00 be 0f 8c 10 07   ................
929|   3968: ff ff 00 00 07 05 00 00 00 02 00 aa 0f 9b f0 08   ................
930|   3984: c8 00 00 00 37 06 00 00 00 01 00 96 0f ac 00 08   ....7...........
931|   4000: 00 00 00 b3 07 15 00 10 00 02 00 82 0f ba 00 07   ................
932|   4016: 00 00 00 06 05 00 00 00 01 6e 0f c8 00 07 00 00   .........n......
933|   4032: 00 06 05 00 00 00 01 5a 03 f6 00 07 00 00 00 06   .......Z........
934|   4048: 05 00 00 00 01 46 0f e4 00 07 00 00 10 06 05 00   .....F..........
935|   4064: 00 00 01 32 10 02 00 07 00 00 00 07 05 00 00 00   ...2............
936|   4080: 01 1d ff ff ff 07 10 00 00 06 05 00 00 00 01 0a   ................
937| page 6 offset 20480
938|    624: 00 00 00 00 00 21 97 00 00 00 00 00 00 00 00 00   .....!..........
939|   1120: 00 00 00 00 00 24 57 3e 00 00 00 00 00 00 00 00   .....$W>........
940|   1616: 00 00 00 00 1f 97 00 00 00 00 00 00 00 00 00 00   ................
941|   2112: 00 00 00 1e 97 3d 00 00 00 00 00 00 00 00 00 00   .....=..........
942|   2608: 00 1d 97 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
943| page 8 offset 28672
944|   1184: 00 00 00 00 00 00 00 00 00 97 4d 1e 13 ff ae 7c   ..........M....|
945|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90   ................
946| page 9 offset 32768
947|    256: 0d 01 c0 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
948| page 10 offset 36864
949|      0: 0d 00 22 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
950|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05   ................
951| page 12 offset 45056
952|      0: 0d 00 00 00 01 04 30 00 00 00 00 00 00 00 00 00   ......0.........
953| page 14 offset 53248
954|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
955|   1072: 96 4d 5a 14 00 00 00 00 00 00 00 00 00 00 00 00   .MZ.............
956| page 16 offset 61440
957|      0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00   ......0..0......
958|   1072: 97 4d 6e 14 00 ae 7b ff ff ff ff 00 00 00 00 00   .Mn.............
959| page 18 offset 69632
960|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
961|   1072: 4d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   M...............
962|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d   ................
963| page 20 offset 77824
964|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
965|   1072: 4d 81 16 14 00 ae 00 00 00 00 00 00 00 00 00 00   M...............
966|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0f   ................
967| page 22 offset 86016
968|      0: 0d 00 00 00 01 04 2f 00 04 2f 01 00 00 00 00 00   ....../../......
969|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
970|   1072: 4d 81 2a 14 00 00 00 00 00 00 00 00 00 00 00 00   M.*.............
971| page 24 offset 94208
972|   1072: 00 97 4c 0a 14 00 ae 7c 00 00 00 00 00 00 00 00   ..L....|........
973| page 25 offset 98304
974|   1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97   ................
975|   1072: 4d 81 3e 14 00 ae 7c 00 00 18 ff 00 00 00 00 00   M.>...|.........
976| page 27 offset 106496
977|      0: 00 00 00 00 00 00 00 12 00 00 00 07 00 00 00 1d   ................
978|     16: 00 00 00 09 00 00 00 1f 00 00 00 0b 00 00 00 21   ...............!
979|     32: 00 00 00 0d 00 10 00 25 00 00 00 0f 00 00 00 27   .......%.......'
980|     48: 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00   ................
981| page 32 offset 126976
982|   2512: 00 00 00 00 00 00 00 45 21 00 00 00 00 00 00 00   .......E!.......
983| page 35 offset 139264
984|      0: 00 0a 08 44 00 05 02 77 00 0e 11 0a 92 00 00 00   ...D...w........
985|   1120: 00 00 00 00 00 20 97 00 00 00 00 00 00 00 00 00   ..... ..........
986|   1616: 00 00 00 00 22 00 00 00 00 00 00 00 00 00 00 00   ................
987|   2608: 00 00 00 97 3d 04 00 00 00 00 00 00 00 00 00 00   ....=...........
988|   3104: 00 1c 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
989|   3600: 00 97 3d 04 ae 7c 00 00 00 00 00 00 00 00 00 00   ..=..|..........
990|   4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1a   ................
991| page 36 offset 143360
992|      0: 0a 08 44 00 04 02 00 00 00 00 00 00 00 00 00 00   ..D.............
993|   1120: 00 00 00 00 00 2a 97 3e 04 00 00 00 00 00 00 00   .....*.>........
994|   1616: 00 00 00 00 2c 97 3e 00 00 00 00 00 00 00 00 00   ....,.>.........
995|   2112: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38   ...............8
996|   2128: 00 00 05 cd 00 00 00 00 00 00 00 00 00 00 00 00   ................
997|   3600: 00 97 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
998| page 38 offset 151552
999|   2464: 00 00 00 00 00 00 00 00 00 6e 00 00 00 00 00 00   .........n......
1000| page 40 offset 159744
1001|   2512: 00 00 00 00 00 00 00 00 82 00 00 00 00 00 00 00   ................
1002| page 42 offset 167936
1003|   2512: 00 00 00 00 00 00 00 96 00 00 00 00 00 00 00 00   ................
1004| page 44 offset 176128
1005|   2512: 00 00 00 00 00 00 00 00 aa 00 00 00 00 00 00 00   ................
1006| end crash-41390d95d613b6.db
1007}]} {}
1008
1009do_catchsql_test 10.1 {
1010  PRAGMA writable_schema=ON; -- bypass improved sqlite_master consistency checking
1011  SELECT * FROM t1 WHERE a<='2019-05-09' ORDER BY a DESC;
1012} {1 {database disk image is malformed}}
1013
1014
1015#-------------------------------------------------------------------------
1016reset_db
1017do_test 11.0 {
1018  sqlite3 db {}
1019  db deserialize [decode_hexdb {
1020| size 595 pagesize 512 filename x.db
1021| page 1 offset 0
1022|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
1023|     16: 02 00 00 01 00 40 20 20 00 01 00 0c 00 00 00 07   .....@  ........
1024|     32: 00 00 00 05 07 a1 1f fa 00 00 00 08 00 00 00 04   ................
1025|     48: 00 00 01 00 00 49 00 00 00 00 00 05 00 00 00 00   .....I..........
1026|     80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1c   ................
1027|     96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0   ..,P............
1028|    112: 01 56 01 86 01 2a 01 06 00 00 62 00 00 00 00 00   .V...*....b.....
1029|    128: 00 ed e2 78 74 64 33 ff 43 52 45 41 54 45 20 49   ...xtd3.CREATE I
1030|    144: 4e 44 45 58 20 74 33 78 20 4f 4e 20 74 33 28 38   NDEX t3x ON t3(8
1031|    160: 29 2e 04 06 17 15 11 01 45 69 6e 64 65 68 74 32   ).......Eindeht2
1032|    176: 63 64 74 31 e5 43 52 45 41 54 45 20 49 4e 44 45   cdt1.CREATE INDE
1033|    192: 58 20 74 32 63 c4 20 4f 4e 20 74 32 28 63 2c 64   X t2c. ON t2(c,d
1034|    208: 29 28 05 06 17 01 11 11 3d 74 61 6c 36 74 62 74   )(......=tal6tbt
1035|    224: 65 32 04 43 52 45 41 54 45 20 54 41 42 4c 45 20   e2.CREATE TABLE
1036|    240: 74 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00   t...............
1037|    256: 00 00 00 00 00 00 22 07 06 17 11 11 01 30 e8 03   .............0..
1038|    272: 62 6c 65 74 34 74 35 02 43 52 45 41 54 45 20 54   blet4t5.CREATE T
1039|    288: 41 42 4c 45 20 74 34 28 94 29 2a 06 06 17 13 11   ABLE t4(.)*.....
1040|    304: 01 3f 69 33 74 6e 65 78 78 74 64 33 ff 43 52 45   .?i3tnexxtd3.CRE
1041|    320: 41 54 45 20 49 4e 44 45 58 20 74 33 78 20 4f 4e   ATE INDEX t3x ON
1042|    336: 20 74 31 28 38 29 2e 04 06 17 15 11 01 45 69 6e    t1(8).......Ein
1043|    352: 64 65 68 74 32 63 64 74 31 e5 43 52 45 41 54 45   deht2cdt1.CREATE
1044|    368: 20 49 4e 44 45 58 20 74 32 63 c4 20 4f 4e 20 74    INDEX t2c. ON t
1045|    384: 32 28 63 2c 64 29 28 05 06 17 01 11 11 3d 74 61   2(c,d)(......=ta
1046|    400: 6c 32 74 62 74 65 32 04 43 52 45 41 54 45 20 54   l2tbte2.CREATE T
1047|    416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29   ABLE t3(c,x,e,f)
1048|    432: 28 02 06 17 11 11 01 3d 74 61 9e 93 65 74 32 74   (......=ta..et2t
1049|    448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74   2.CREATE TABLE t
1050|    464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11   2(c,d,e,f)$.....
1051|    480: 01 35 55 61 62 6c 88 74 31 74 31 02 43 52 45 41   .5Uabl.t1t1.CREA
1052|    496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29   TE TABLE t1(a,b)
1053| page 2 offset 512
1054|      0: 0d 00 00 00 0d 25 00 01 cf 00 01 fa 01 f3 01 de   .....%..........
1055|     16: 01 00 00 00 fd 00 00 0d 00 00 00 00 45 20 54 41   ............E TA
1056|     32: 42 4c 45 20 74 34 28 94 29 2a 06 06 17 13 11 01   BLE t4(.)*......
1057|     48: 3f 69 33 74 6e 65 78 78 74 64 33 ff 43 52 45 a0   ?i3tnexxtd3.CRE.
1058|     64: a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 74 13 11 01   ............t...
1059|     80: 49 45 74 00 00 00 00 00 00 00 00 00 00 00 00 00   IEt.............
1060| end x.db
1061}]} {}
1062
1063do_catchsql_test 11.1 {
1064  PRAGMA writable_schema=ON; -- bypass improved sqlite_master consistency checking
1065  DELETE FROM t3 WHERE x IN (SELECT x FROM t4);
1066} {1 {database disk image is malformed}}
1067
1068finish_test
1069