| 1 |
# 2012-12-13 |
| 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 |
# Test cases for corrupt database files. |
| 13 |
|
| 14 |
set testdir [file dirname $argv0] |
| 15 |
source $testdir/tester.tcl |
| 16 |
|
| 17 |
ifcapable !deserialize { |
| 18 |
finish_test |
| 19 |
return |
| 20 |
} |
| 21 |
database_may_be_corrupt |
| 22 |
|
| 23 |
# In the following database file, there is 384 bytes of free space |
| 24 |
# on page 8 that does not appear on the freeblock list. |
| 25 |
# |
| 26 |
do_test dbfuzz001-100 { |
| 27 |
sqlite3 db {} |
| 28 |
db deserialize [decode_hexdb { |
| 29 |
| size 5632 pagesize 512 filename c4.db |
| 30 |
| page 1 offset 0 |
| 31 |
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. |
| 32 |
| 16: 02 00 01 01 00 40 20 20 00 00 00 02 00 00 00 0b .....@ ........ |
| 33 |
| 32: 00 00 00 06 00 00 00 01 00 00 00 28 00 00 00 04 ...........(.... |
| 34 |
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................ |
| 35 |
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 ................ |
| 36 |
| 96: 00 2e 30 38 0d 00 00 00 06 01 06 00 01 da 01 b0 ..08............ |
| 37 |
| 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*.......... |
| 38 |
| 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta |
| 39 |
| 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T |
| 40 |
| 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*..... |
| 41 |
| 304: 01 3f 69 6e 64 65 78 00 00 00 00 00 00 00 00 00 .?index......... |
| 42 |
| 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein |
| 43 |
| 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE |
| 44 |
| 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t |
| 45 |
| 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta |
| 46 |
| 400: 62 6c 65 74 33 74 33 04 43 52 45 41 54 45 20 54 blet3t3.CREATE T |
| 47 |
| 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f) |
| 48 |
| 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t |
| 49 |
| 448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 2.CREATE TABLE t |
| 50 |
| 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$..... |
| 51 |
| 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA |
| 52 |
| 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b) |
| 53 |
| page 2 offset 512 |
| 54 |
| 0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................ |
| 55 |
| page 3 offset 1024 |
| 56 |
| 0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................ |
| 57 |
| page 4 offset 1536 |
| 58 |
| 0: 05 00 00 00 03 01 f1 00 00 00 00 0b 01 fb 01 f6 ................ |
| 59 |
| 16: 01 f1 00 16 00 00 09 06 05 01 01 01 01 04 04 03 ................ |
| 60 |
| 32: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................ |
| 61 |
| 48: 17 73 65 76 65 6e 65 69 67 68 74 65 69 67 68 74 .seveneighteight |
| 62 |
| 64: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@... |
| 63 |
| 80: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@... |
| 64 |
| 96: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@........... |
| 65 |
| 112: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................ |
| 66 |
| 352: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1a ................ |
| 67 |
| 496: 00 00 00 00 0a 3e 00 00 00 09 21 00 00 00 08 06 .....>....!..... |
| 68 |
| page 5 offset 2048 |
| 69 |
| 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................ |
| 70 |
| page 7 offset 3072 |
| 71 |
| 0: 0d 00 00 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec ................ |
| 72 |
| 16: 01 e0 01 d4 01 cb 01 c2 00 00 00 00 00 00 00 00 ................ |
| 73 |
| 96: 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 74 |
| 224: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 ................ |
| 75 |
| 288: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 ................ |
| 76 |
| 448: 00 00 07 08 02 17 65 69 67 68 74 07 07 02 17 65 ......eight....e |
| 77 |
| 464: 69 67 68 74 0a 06 02 07 40 18 00 00 00 00 00 00 ight....@....... |
| 78 |
| 480: 0a 05 02 07 40 18 00 00 00 00 00 00 03 04 02 01 ....@........... |
| 79 |
| 496: 04 03 03 02 01 04 03 02 02 01 02 03 01 02 01 02 ................ |
| 80 |
| page 8 offset 3584 |
| 81 |
| 0: 0d 00 21 00 01 00 16 00 00 16 00 16 00 16 00 16 ..!............. |
| 82 |
| 16: 00 16 00 16 00 00 09 06 05 01 01 01 01 04 04 03 ................ |
| 83 |
| 32: 03 00 00 00 5f 01 09 09 02 02 00 00 00 56 17 17 ...._........V.. |
| 84 |
| 48: 17 73 65 76 65 6e 65 69 67 68 74 65 69 67 68 74 .seveneighteight |
| 85 |
| 64: 73 65 76 65 6e 00 00 00 3b 07 07 07 40 14 00 00 seven...;...@... |
| 86 |
| 80: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@... |
| 87 |
| 96: 00 00 00 00 40 14 00 00 00 00 00 00 00 00 00 14 ....@........... |
| 88 |
| 112: 01 01 01 03 04 04 03 00 00 00 09 01 01 09 02 02 ................ |
| 89 |
| 352: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1a ................ |
| 90 |
| page 9 offset 4096 |
| 91 |
| 0: 0d 00 00 00 1b 00 47 00 01 d9 01 be 01 af 01 a0 ......G......... |
| 92 |
| 16: 01 91 01 82 01 73 01 64 01 55 01 46 01 37 01 28 .....s.d.U.F.7.( |
| 93 |
| 32: 01 19 01 0a 00 fb 00 ec 00 dd 00 ce 00 bf 00 b0 ................ |
| 94 |
| 48: 00 a1 00 92 00 83 00 74 00 65 00 56 00 47 00 00 .......t.e.V.G.. |
| 95 |
| 64: 00 00 00 00 00 00 00 0d 21 00 00 48 01 54 00 01 ........!..H.T.. |
| 96 |
| 80: f7 01 ec 01 c5 01 0d 20 00 00 48 01 54 00 01 f7 ....... ..H.T... |
| 97 |
| 96: 01 ec 01 c5 01 0d 1f 00 00 48 01 54 00 01 f7 01 .........H.T.... |
| 98 |
| 112: ec 01 c5 01 0d 1e 00 00 48 01 54 00 01 f7 01 ec ........H.T..... |
| 99 |
| 128: 01 c5 01 0d 1d 00 00 48 01 54 00 01 f7 01 ec 01 .......H.T...... |
| 100 |
| 144: c5 01 0d 1c 00 00 48 01 54 00 01 f7 01 ec 01 c5 ......H.T....... |
| 101 |
| 160: 01 0d 1b 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 .....H.T........ |
| 102 |
| 176: 0d 1a 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d ....H.T......... |
| 103 |
| 192: 19 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 18 ...H.T.......... |
| 104 |
| 208: 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 17 00 ..H.T........... |
| 105 |
| 224: 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 16 00 00 .H.T............ |
| 106 |
| 240: 48 01 54 00 01 f7 01 ec 01 c5 01 0d 15 00 00 48 H.T............H |
| 107 |
| 256: 01 54 00 01 f7 01 ec 01 c5 01 0d 14 00 00 48 01 .T............H. |
| 108 |
| 272: 54 00 01 f7 01 ec 01 c5 01 0d 13 00 00 48 01 54 T............H.T |
| 109 |
| 288: 00 01 f7 01 ec 01 c5 01 0d 12 00 00 48 01 54 00 ............H.T. |
| 110 |
| 304: 01 f7 01 ec 01 c5 01 0d 11 00 00 48 01 54 00 01 ...........H.T.. |
| 111 |
| 320: f7 01 ec 01 c5 01 0d 10 00 00 48 01 54 00 01 f7 ..........H.T... |
| 112 |
| 336: 01 ec 01 c5 01 0d 0f 00 00 48 01 54 00 01 f7 01 .........H.T.... |
| 113 |
| 352: ec 01 c5 01 0d 0e 00 00 48 01 54 00 01 f7 01 ec ........H.T..... |
| 114 |
| 368: 01 c5 01 0d 0d 00 00 48 01 54 00 01 f7 01 ec 01 .......H.T...... |
| 115 |
| 384: c5 01 0d 0c 00 00 48 01 54 00 01 f7 01 ec 01 c5 ......H.T....... |
| 116 |
| 400: 01 0d 0b 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 .....H.T........ |
| 117 |
| 416: 0d 0a 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d ....H.T......... |
| 118 |
| 432: 09 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 19 08 ...H.T.......... |
| 119 |
| 448: 05 17 17 17 17 65 69 67 68 74 65 69 67 68 74 73 .....eighteights |
| 120 |
| 464: 65 76 65 6e 73 65 76 65 6e 25 07 05 07 07 07 07 evenseven%...... |
| 121 |
| 480: 40 18 00 00 00 00 00 00 40 18 00 00 00 00 00 00 @.......@....... |
| 122 |
| 496: 40 14 00 00 00 00 00 00 40 14 00 00 00 00 00 00 @.......@....... |
| 123 |
| page 10 offset 4608 |
| 124 |
| 0: 0d 00 00 00 1d 00 4d 00 01 f1 01 e2 01 d3 01 c4 ......M......... |
| 125 |
| 16: 01 b5 01 a6 01 97 01 88 01 79 01 6a 01 5b 01 4c .........y.j.[.L |
| 126 |
| 32: 01 3d 01 2e 01 1f 01 10 01 01 00 f2 00 e3 00 d4 .=.............. |
| 127 |
| 48: 00 c5 00 b6 00 a7 00 98 00 89 00 7a 00 6b 00 5c ...........z.k.\ |
| 128 |
| 64: 00 4d 00 00 00 00 00 00 00 00 00 00 00 0d 3e 00 .M............>. |
| 129 |
| 80: 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 3d 00 00 .H.T.........=.. |
| 130 |
| 96: 48 01 54 00 01 f7 01 ec 01 c5 01 0d 3c 00 00 48 H.T.........<..H |
| 131 |
| 112: 01 54 00 01 f7 01 ec 01 c5 01 0d 3b 00 00 48 01 .T.........;..H. |
| 132 |
| 128: 54 00 01 f7 01 ec 01 c5 01 0d 3a 00 00 48 01 54 T.........:..H.T |
| 133 |
| 144: 00 01 f7 01 ec 01 c5 01 0d 39 00 00 48 01 54 00 .........9..H.T. |
| 134 |
| 160: 01 f7 01 ec 01 c5 01 0d 38 00 00 48 01 54 00 01 ........8..H.T.. |
| 135 |
| 176: f7 01 ec 01 c5 01 0d 37 00 00 48 01 54 00 01 f7 .......7..H.T... |
| 136 |
| 192: 01 ec 01 c5 01 0d 36 00 00 48 01 54 00 01 f7 01 ......6..H.T.... |
| 137 |
| 208: ec 01 c5 01 0d 35 00 00 48 01 54 00 01 f7 01 ec .....5..H.T..... |
| 138 |
| 224: 01 c5 01 0d 34 00 00 48 01 54 00 01 f7 01 ec 01 ....4..H.T...... |
| 139 |
| 240: c5 01 0d 33 00 00 48 01 54 00 01 f7 01 ec 01 c5 ...3..H.T....... |
| 140 |
| 256: 01 0d 32 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 ..2..H.T........ |
| 141 |
| 272: 0d 31 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d .1..H.T......... |
| 142 |
| 288: 30 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2f 0..H.T........./ |
| 143 |
| 304: 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2e 00 ..H.T........... |
| 144 |
| 320: 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2d 00 00 .H.T.........-.. |
| 145 |
| 336: 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2c 00 00 48 H.T.........,..H |
| 146 |
| 352: 01 54 00 01 f7 01 ec 01 c5 01 0d 2b 00 00 48 01 .T.........+..H. |
| 147 |
| 368: 54 00 01 f7 01 ec 01 c5 01 0d 2a 00 00 48 01 54 T.........*..H.T |
| 148 |
| 384: 00 01 f7 01 ec 01 c5 01 0d 29 00 00 48 01 54 00 .........)..H.T. |
| 149 |
| 400: 01 f7 01 ec 01 c5 01 0d 28 00 00 48 01 54 00 01 ........(..H.T.. |
| 150 |
| 416: f7 01 ec 01 c5 01 0d 27 00 00 48 01 54 00 01 f7 .......'..H.T... |
| 151 |
| 432: 01 ec 01 c5 01 0d 26 00 00 48 01 54 00 01 f7 01 ......&..H.T.... |
| 152 |
| 448: ec 01 c5 01 0d 25 00 00 48 01 54 00 01 f7 01 ec .....%..H.T..... |
| 153 |
| 464: 01 c5 01 0d 24 00 00 48 01 54 00 01 f7 01 ec 01 ....$..H.T...... |
| 154 |
| 480: c5 01 0d 23 00 00 48 01 54 00 01 f7 01 ec 01 c5 ...#..H.T....... |
| 155 |
| 496: 01 0d 22 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 .."..H.T........ |
| 156 |
| page 11 offset 5120 |
| 157 |
| 0: 0d 00 00 00 0a 01 6a 00 01 f1 01 e2 01 d3 01 c4 ......j......... |
| 158 |
| 16: 01 b5 01 a6 01 97 01 88 01 79 01 6a 00 00 00 00 .........y.j.... |
| 159 |
| 352: 00 00 00 00 00 00 00 00 00 00 0d 48 00 00 48 01 ...........H..H. |
| 160 |
| 368: 54 00 01 f7 01 ec 01 c5 01 0d 47 00 00 48 01 54 T.........G..H.T |
| 161 |
| 384: 00 01 f7 01 ec 01 c5 01 0d 46 00 00 48 01 54 00 .........F..H.T. |
| 162 |
| 400: 01 f7 01 ec 01 c5 01 0d 45 00 00 48 01 54 00 01 ........E..H.T.. |
| 163 |
| 416: f7 01 ec 01 c5 01 0d 44 00 00 48 01 54 00 01 f7 .......D..H.T... |
| 164 |
| 432: 01 ec 01 c5 01 0d 43 00 00 48 01 54 00 01 f7 01 ......C..H.T.... |
| 165 |
| 448: ec 01 c5 01 0d 42 00 00 48 01 54 00 01 f7 01 ec .....B..H.T..... |
| 166 |
| 464: 01 c5 01 0d 41 00 00 48 01 54 00 01 f7 01 ec 01 ....A..H.T...... |
| 167 |
| 480: c5 01 0d 40 00 00 48 01 54 00 01 f7 01 ec 01 c5 [email protected]....... |
| 168 |
| 496: 01 0d 3f 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 ..?..H.T........ |
| 169 |
| end c4.db |
| 170 |
}] |
| 171 |
} {} |
| 172 |
|
| 173 |
ifcapable !oversize_cell_check { |
| 174 |
# Non SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds: |
| 175 |
do_test dbfuzz001-101a { |
| 176 |
db eval {PRAGMA writable_schema=on; PRAGMA integrity_check} |
| 177 |
} {/Fragmentation of 384 bytes reported as 0 on page 8/} |
| 178 |
} else { |
| 179 |
# SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds: |
| 180 |
do_catchsql_test dbfuzz001-101b { |
| 181 |
PRAGMA writable_schema=on; |
| 182 |
PRAGMA integrity_check; |
| 183 |
} {1 {database disk image is malformed}} |
| 184 |
} |
| 185 |
|
| 186 |
# The DELETE query below deletes the very last cell from page 8. |
| 187 |
# Prior to a certain fix to sqlite3BtreeDelete() and because of the |
| 188 |
# corruption to the freeblock list on page 8, this would fail to |
| 189 |
# cause a rebalance operation, which would leave the btree in a weird |
| 190 |
# state that would lead to segfaults and or assertion faults. |
| 191 |
# |
| 192 |
do_execsql_test dbfuzz001-110 { |
| 193 |
DELETE FROM t3 WHERE x IS NOT NULL AND +rowid=6; |
| 194 |
} {} |
| 195 |
|
| 196 |
# This is a dbfuzz2-generate test case that can cause a page with |
| 197 |
# pPage->nCell==0 to enter the balancer. |
| 198 |
# |
| 199 |
do_test dbfuzz001-200 { |
| 200 |
db deserialize [decode_hexdb { |
| 201 |
| size 3076 pagesize 512 filename c03.db |
| 202 |
| page 1 offset 0 |
| 203 |
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. |
| 204 |
| 16: 02 00 01 01 00 40 20 20 00 00 00 0c 00 00 00 07 .....@ ........ |
| 205 |
| 32: 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 04 ................ |
| 206 |
| 48: 00 00 00 00 00 00 00 03 e8 00 00 01 00 00 00 00 ................ |
| 207 |
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c ................ |
| 208 |
| 96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0 ..,P............ |
| 209 |
| 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*.......... |
| 210 |
| 128: 00 00 00 00 00 00 00 00 ef 00 00 00 00 00 00 00 ................ |
| 211 |
| 192: 00 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 212 |
| 224: 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e9 00 ................ |
| 213 |
| 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta |
| 214 |
| 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T |
| 215 |
| 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*..... |
| 216 |
| 304: 01 3f 69 6e 64 65 78 74 33 78 74 33 06 43 52 45 .?indext3xt3.CRE |
| 217 |
| 320: 41 54 45 20 49 4e 44 45 58 20 74 33 64 20 4f 4e ATE INDEX t3d ON |
| 218 |
| 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein |
| 219 |
| 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE |
| 220 |
| 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t |
| 221 |
| 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta |
| 222 |
| 400: 62 6c 65 74 33 74 33 04 43 52 45 41 54 45 20 54 blet3t3.CREATE T |
| 223 |
| 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f) |
| 224 |
| 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t |
| 225 |
| 448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 2.CREATE TABLE t |
| 226 |
| 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$..... |
| 227 |
| 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA |
| 228 |
| 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b) |
| 229 |
| page 2 offset 512 |
| 230 |
| 0: 0d 00 00 00 04 01 cf 00 01 fa 01 f3 01 de 01 cf ................ |
| 231 |
| 176: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 232 |
| 256: 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 233 |
| 368: 00 00 00 00 00 00 00 00 00 00 00 00 1e 00 00 00 ................ |
| 234 |
| 416: 00 00 00 1b 00 00 00 00 04 00 00 00 00 00 00 00 ................ |
| 235 |
| 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ................ |
| 236 |
| 464: 04 03 17 17 73 65 76 65 6e 65 69 67 68 74 13 03 ....seveneight.. |
| 237 |
| 480: 03 07 07 40 14 00 00 00 00 00 00 40 18 00 00 00 ...@.......@.... |
| 238 |
| 496: 00 00 00 05 02 03 01 01 03 04 04 01 03 09 01 02 ................ |
| 239 |
| page 3 offset 1024 |
| 240 |
| 0: 0d 00 00 00 08 01 54 00 01 f7 01 ec 01 c5 01 aa ......T......... |
| 241 |
| 16: 01 a1 01 96 01 6f 01 54 00 00 00 00 00 00 00 00 .....o.T........ |
| 242 |
| 32: 00 00 00 00 00 00 00 03 e8 00 00 00 00 00 00 00 ................ |
| 243 |
| 336: 00 00 00 00 19 08 05 16 17 17 17 65 69 67 68 74 ...........eight |
| 244 |
| 352: 65 69 67 68 74 73 65 76 65 6e 73 65 76 ff ff ff eightsevensev... |
| 245 |
| 368: 0e 05 07 07 07 07 40 18 00 00 00 00 00 00 40 18 ......@.......@. |
| 246 |
| 384: 00 00 00 00 00 00 40 14 00 00 00 00 00 00 40 14 ......@.......@. |
| 247 |
| 400: 00 00 00 00 00 00 09 06 05 01 01 01 01 04 04 03 ................ |
| 248 |
| 416: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................ |
| 249 |
| 432: 17 73 65 6f 65 6e 65 69 67 68 74 65 69 67 68 74 .seoeneighteight |
| 250 |
| 448: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@... |
| 251 |
| 464: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@... |
| 252 |
| 480: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@........... |
| 253 |
| 496: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................ |
| 254 |
| page 4 offset 1536 |
| 255 |
| 0: 0d 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 ................ |
| 256 |
| 160: 00 00 00 ea 00 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 257 |
| 336: 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 ............ ... |
| 258 |
| page 5 offset 2048 |
| 259 |
| 0: 0a 00 00 00 08 01 96 00 01 fa 01 c4 01 f2 01 bc ................ |
| 260 |
| 16: 01 dc 01 a6 01 96 01 cc 00 00 00 00 00 00 00 00 ................ |
| 261 |
| 48: 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 ................ |
| 262 |
| 288: 00 00 00 00 00 00 00 00 00 64 00 00 00 2b 00 00 .........d...+.. |
| 263 |
| 400: 00 00 00 00 00 00 0f 04 17 17 01 65 69 67 68 74 ...........eight |
| 264 |
| 416: 65 69 6f 68 74 08 15 04 07 07 01 40 18 00 00 00 eioht......@.... |
| 265 |
| 432: 00 00 00 40 18 00 00 00 00 00 00 07 07 04 01 01 ...@............ |
| 266 |
| 448: 01 04 04 06 07 04 01 01 01 02 02 05 0f 04 17 17 ................ |
| 267 |
| 464: 01 73 65 76 65 6e 65 69 67 68 74 04 15 04 07 07 .seveneight..... |
| 268 |
| 480: 01 40 14 00 00 00 00 00 00 40 18 00 00 00 00 00 .@.......@...... |
| 269 |
| 496: 00 03 07 04 01 01 01 03 04 02 05 04 09 01 09 02 ................ |
| 270 |
| page 6 offset 2560 |
| 271 |
| 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 0d 00 00 ................ |
| 272 |
| 16: 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec 01 e0 01 ................ |
| 273 |
| 32: d4 01 cb 01 c2 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 274 |
| 160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 ................ |
| 275 |
| 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 ................ |
| 276 |
| 464: 08 02 17 65 69 67 68 74 07 07 02 17 65 69 67 68 ...eight....eigh |
| 277 |
| 480: 74 0a 06 02 07 40 18 00 00 00 00 00 00 0a 05 02 t....@.......... |
| 278 |
| 496: 07 40 18 00 04 02 01 04 03 03 02 01 04 03 02 02 .@.............. |
| 279 |
| end x/c03.db |
| 280 |
}] |
| 281 |
catchsql {INSERT INTO t3 SELECT * FROM t2;} |
| 282 |
} {1 {database disk image is malformed}} |
| 283 |
|
| 284 |
|
| 285 |
do_test dbfuzz001-310 { |
| 286 |
sqlite3 db {} |
| 287 |
db deserialize [decode_hexdb { |
| 288 |
| size 3584 pagesize 512 filename x/c02.db |
| 289 |
| page 1 offset 0 |
| 290 |
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. |
| 291 |
| 16: 02 00 01 01 00 40 20 20 00 00 00 0c 00 00 00 07 .....@ ........ |
| 292 |
| 32: 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 04 ................ |
| 293 |
| 48: 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 00 ................ |
| 294 |
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c ................ |
| 295 |
| 96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0 ..,P............ |
| 296 |
| 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*.......... |
| 297 |
| 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta |
| 298 |
| 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T |
| 299 |
| 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*..... |
| 300 |
| 304: 01 3f 69 6e 64 65 78 74 33 78 74 33 05 43 52 45 .?indext3xt3.CRE |
| 301 |
| 320: 41 54 45 20 49 4e 44 45 58 20 74 33 78 20 4f 4e ATE INDEX t3x ON |
| 302 |
| 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein |
| 303 |
| 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE |
| 304 |
| 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t |
| 305 |
| 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta |
| 306 |
| 400: 62 6c 65 74 33 74 33 07 43 52 45 41 54 45 20 54 blet3t3.CREATE T |
| 307 |
| 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f) |
| 308 |
| 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t |
| 309 |
| 448: 32 32 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 22CREATE TABLE t |
| 310 |
| 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$..... |
| 311 |
| 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA |
| 312 |
| 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b) |
| 313 |
| page 2 offset 512 |
| 314 |
| 0: 0d 00 00 00 04 01 cf 00 01 fa 01 f3 01 de 01 cf ................ |
| 315 |
| 160: 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 .. ............. |
| 316 |
| 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ................ |
| 317 |
| 464: 04 03 17 17 73 65 76 65 6e 65 69 67 68 74 13 03 ....seveneight.. |
| 318 |
| 480: 03 07 07 40 14 00 00 00 00 00 00 40 18 00 00 00 ...@.......@.... |
| 319 |
| 496: 00 00 00 05 02 03 01 01 03 04 04 01 03 09 01 02 ................ |
| 320 |
| page 3 offset 1024 |
| 321 |
| 0: 0d 00 00 00 08 01 54 00 01 f7 01 ec 01 c5 01 aa ......T......... |
| 322 |
| 16: 01 a1 01 96 01 6f 01 54 00 00 00 00 00 00 00 00 .....o.T........ |
| 323 |
| 112: 00 00 dd 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 324 |
| 336: 00 00 00 00 19 08 05 17 17 17 17 65 69 67 68 74 ...........eight |
| 325 |
| 352: 65 69 67 68 74 73 65 76 65 6e 73 65 76 65 6e 25 eightsevenseven% |
| 326 |
| 368: 07 05 07 07 07 07 40 18 00 00 00 00 00 00 40 18 ......@.......@. |
| 327 |
| 384: 00 00 00 00 00 00 40 14 00 00 00 00 00 00 40 14 ......@.......@. |
| 328 |
| 400: 00 00 00 00 00 00 09 06 05 01 01 01 01 04 04 03 ................ |
| 329 |
| 416: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................ |
| 330 |
| 432: 17 73 65 76 65 6e 65 69 67 68 74 65 69 67 68 74 .seveneighteight |
| 331 |
| 448: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@... |
| 332 |
| 464: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@... |
| 333 |
| 480: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@........... |
| 334 |
| 496: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................ |
| 335 |
| page 4 offset 1536 |
| 336 |
| 0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................ |
| 337 |
| 192: 00 00 00 00 00 00 7f 00 00 00 00 00 00 00 00 00 ................ |
| 338 |
| 208: 00 e5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ |
| 339 |
| page 5 offset 2048 |
| 340 |
| 0: 0a 00 00 00 08 01 96 00 01 fa 01 c4 01 f2 01 bc ................ |
| 341 |
| 16: 01 dc 01 a6 01 96 01 cc 00 00 00 00 00 00 00 00 ................ |
| 342 |
| 240: 00 00 00 00 00 00 00 00 00 00 00 00 00 0e 00 00 ................ |
| 343 |
| 400: 00 00 00 00 00 00 0f 04 17 07 01 65 69 67 68 74 ...........eight |
| 344 |
| 416: 65 69 67 68 74 08 15 04 07 07 01 40 18 00 00 00 eight......@.... |
| 345 |
| 432: 00 00 00 40 18 00 00 00 00 00 00 07 07 04 01 01 ...@............ |
| 346 |
| 448: 01 04 04 06 07 04 01 01 01 02 02 05 0f 04 17 17 ................ |
| 347 |
| 464: 01 73 65 76 65 6e 65 69 67 68 74 04 15 04 07 07 .seveneight..... |
| 348 |
| 480: 01 40 14 00 00 00 00 00 00 40 18 00 00 00 00 00 .@.......@...... |
| 349 |
| 496: 00 03 07 04 01 01 01 03 04 02 05 04 09 01 09 02 ................ |
| 350 |
| page 6 offset 2560 |
| 351 |
| 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................ |
| 352 |
| 464: 00 00 00 00 00 00 00 00 00 00 7f 00 00 00 00 00 ................ |
| 353 |
| page 7 offset 3072 |
| 354 |
| 0: 0d 00 00 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec ................ |
| 355 |
| 16: 01 e0 01 d4 01 cb 01 c2 00 00 00 00 00 00 00 00 ................ |
| 356 |
| 448: 00 00 07 08 02 17 65 69 67 68 74 07 07 02 17 65 ......eight....e |
| 357 |
| 464: 69 67 68 74 0a 06 02 07 40 18 00 00 00 00 00 00 ight....@....... |
| 358 |
| 480: 0a 05 02 07 40 18 00 00 00 00 00 00 03 04 02 01 ....@........... |
| 359 |
| 496: 04 03 03 02 01 04 03 02 02 01 02 03 01 02 01 02 ................ |
| 360 |
| end x/c02.db |
| 361 |
}] |
| 362 |
} {} |
| 363 |
|
| 364 |
extra_schema_checks 0 |
| 365 |
do_catchsql_test dbfuzz001-320 { |
| 366 |
PRAGMA integrity_check; |
| 367 |
} {1 {database disk image is malformed}} |
| 368 |
|
| 369 |
do_catchsql_test dbfuzz001-330 { |
| 370 |
DELETE FROM t3 WHERE x IN (SELECT x FROM t4); |
| 371 |
} {1 {database disk image is malformed}} |
| 372 |
extra_schema_checks 1 |
| 373 |
|
| 374 |
#------------------------------------------------------------------------- |
| 375 |
reset_db |
| 376 |
|
| 377 |
do_execsql_test dbfuzz001-430 { |
| 378 |
CREATE TABLE t1(a INTEGER, b INT, c DEFAULT 0); |
| 379 |
} |
| 380 |
|
| 381 |
do_execsql_test dbfuzz001-420 { |
| 382 |
PRAGMA locking_mode=EXCLUSIVE; |
| 383 |
PRAGMA journal_mode = memory; |
| 384 |
INSERT INTO t1 VALUES(1,2,3); |
| 385 |
PRAGMA journal_mode=PERSIST; |
| 386 |
} {exclusive memory persist} |
| 387 |
|
| 388 |
do_execsql_test dbfuzz001-430 { |
| 389 |
INSERT INTO t1 VALUES(4, 5, 6); |
| 390 |
} |
| 391 |
|
| 392 |
do_execsql_test dbfuzz001-440 { |
| 393 |
PRAGMA journal_mode=MEMORY; |
| 394 |
INSERT INTO t1 VALUES(7, 8, 9); |
| 395 |
} {memory} |
| 396 |
|
| 397 |
finish_test |