Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/dbfuzz001.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / dbfuzz001.test` 398 lines ยท 24634 bytes Raw Blame History 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 ...@..H.T....... 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 PRAGMA cell_size_check=OFF; 194 DELETE FROM t3 WHERE x IS NOT NULL AND +rowid=6; 195 } {} 196 197 # This is a dbfuzz2-generate test case that can cause a page with 198 # pPage->nCell==0 to enter the balancer. 199 # 200 do_test dbfuzz001-200 { 201 db deserialize [decode_hexdb { 202 | size 3076 pagesize 512 filename c03.db 203 | page 1 offset 0 204 | 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. 205 | 16: 02 00 01 01 00 40 20 20 00 00 00 0c 00 00 00 07 .....@ ........ 206 | 32: 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 04 ................ 207 | 48: 00 00 00 00 00 00 00 03 e8 00 00 01 00 00 00 00 ................ 208 | 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c ................ 209 | 96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0 ..,P............ 210 | 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*.......... 211 | 128: 00 00 00 00 00 00 00 00 ef 00 00 00 00 00 00 00 ................ 212 | 192: 00 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 213 | 224: 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e9 00 ................ 214 | 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta 215 | 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T 216 | 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*..... 217 | 304: 01 3f 69 6e 64 65 78 74 33 78 74 33 06 43 52 45 .?indext3xt3.CRE 218 | 320: 41 54 45 20 49 4e 44 45 58 20 74 33 64 20 4f 4e ATE INDEX t3d ON 219 | 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein 220 | 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE 221 | 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t 222 | 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta 223 | 400: 62 6c 65 74 33 74 33 04 43 52 45 41 54 45 20 54 blet3t3.CREATE T 224 | 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f) 225 | 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t 226 | 448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 2.CREATE TABLE t 227 | 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$..... 228 | 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA 229 | 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b) 230 | page 2 offset 512 231 | 0: 0d 00 00 00 04 01 cf 00 01 fa 01 f3 01 de 01 cf ................ 232 | 176: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 233 | 256: 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 234 | 368: 00 00 00 00 00 00 00 00 00 00 00 00 1e 00 00 00 ................ 235 | 416: 00 00 00 1b 00 00 00 00 04 00 00 00 00 00 00 00 ................ 236 | 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ................ 237 | 464: 04 03 17 17 73 65 76 65 6e 65 69 67 68 74 13 03 ....seveneight.. 238 | 480: 03 07 07 40 14 00 00 00 00 00 00 40 18 00 00 00 ...@.......@.... 239 | 496: 00 00 00 05 02 03 01 01 03 04 04 01 03 09 01 02 ................ 240 | page 3 offset 1024 241 | 0: 0d 00 00 00 08 01 54 00 01 f7 01 ec 01 c5 01 aa ......T......... 242 | 16: 01 a1 01 96 01 6f 01 54 00 00 00 00 00 00 00 00 .....o.T........ 243 | 32: 00 00 00 00 00 00 00 03 e8 00 00 00 00 00 00 00 ................ 244 | 336: 00 00 00 00 19 08 05 16 17 17 17 65 69 67 68 74 ...........eight 245 | 352: 65 69 67 68 74 73 65 76 65 6e 73 65 76 ff ff ff eightsevensev... 246 | 368: 0e 05 07 07 07 07 40 18 00 00 00 00 00 00 40 18 ......@.......@. 247 | 384: 00 00 00 00 00 00 40 14 00 00 00 00 00 00 40 14 ......@.......@. 248 | 400: 00 00 00 00 00 00 09 06 05 01 01 01 01 04 04 03 ................ 249 | 416: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................ 250 | 432: 17 73 65 6f 65 6e 65 69 67 68 74 65 69 67 68 74 .seoeneighteight 251 | 448: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@... 252 | 464: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@... 253 | 480: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@........... 254 | 496: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................ 255 | page 4 offset 1536 256 | 0: 0d 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 ................ 257 | 160: 00 00 00 ea 00 00 00 00 00 00 00 00 00 00 00 00 ................ 258 | 336: 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 ............ ... 259 | page 5 offset 2048 260 | 0: 0a 00 00 00 08 01 96 00 01 fa 01 c4 01 f2 01 bc ................ 261 | 16: 01 dc 01 a6 01 96 01 cc 00 00 00 00 00 00 00 00 ................ 262 | 48: 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 ................ 263 | 288: 00 00 00 00 00 00 00 00 00 64 00 00 00 2b 00 00 .........d...+.. 264 | 400: 00 00 00 00 00 00 0f 04 17 17 01 65 69 67 68 74 ...........eight 265 | 416: 65 69 6f 68 74 08 15 04 07 07 01 40 18 00 00 00 eioht......@.... 266 | 432: 00 00 00 40 18 00 00 00 00 00 00 07 07 04 01 01 ...@............ 267 | 448: 01 04 04 06 07 04 01 01 01 02 02 05 0f 04 17 17 ................ 268 | 464: 01 73 65 76 65 6e 65 69 67 68 74 04 15 04 07 07 .seveneight..... 269 | 480: 01 40 14 00 00 00 00 00 00 40 18 00 00 00 00 00 .@.......@...... 270 | 496: 00 03 07 04 01 01 01 03 04 02 05 04 09 01 09 02 ................ 271 | page 6 offset 2560 272 | 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 0d 00 00 ................ 273 | 16: 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec 01 e0 01 ................ 274 | 32: d4 01 cb 01 c2 00 00 00 00 00 00 00 00 00 00 00 ................ 275 | 160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 ................ 276 | 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 ................ 277 | 464: 08 02 17 65 69 67 68 74 07 07 02 17 65 69 67 68 ...eight....eigh 278 | 480: 74 0a 06 02 07 40 18 00 00 00 00 00 00 0a 05 02 t....@.......... 279 | 496: 07 40 18 00 04 02 01 04 03 03 02 01 04 03 02 02 .@.............. 280 | end x/c03.db 281 }] 282 catchsql {INSERT INTO t3 SELECT * FROM t2;} 283 } {1 {database disk image is malformed}} 284 285 286 do_test dbfuzz001-310 { 287 sqlite3 db {} 288 db deserialize [decode_hexdb { 289 | size 3584 pagesize 512 filename x/c02.db 290 | page 1 offset 0 291 | 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. 292 | 16: 02 00 01 01 00 40 20 20 00 00 00 0c 00 00 00 07 .....@ ........ 293 | 32: 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 04 ................ 294 | 48: 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 00 ................ 295 | 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c ................ 296 | 96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0 ..,P............ 297 | 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*.......... 298 | 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta 299 | 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T 300 | 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*..... 301 | 304: 01 3f 69 6e 64 65 78 74 33 78 74 33 05 43 52 45 .?indext3xt3.CRE 302 | 320: 41 54 45 20 49 4e 44 45 58 20 74 33 78 20 4f 4e ATE INDEX t3x ON 303 | 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein 304 | 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE 305 | 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t 306 | 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta 307 | 400: 62 6c 65 74 33 74 33 07 43 52 45 41 54 45 20 54 blet3t3.CREATE T 308 | 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f) 309 | 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t 310 | 448: 32 32 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 22CREATE TABLE t 311 | 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$..... 312 | 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA 313 | 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b) 314 | page 2 offset 512 315 | 0: 0d 00 00 00 04 01 cf 00 01 fa 01 f3 01 de 01 cf ................ 316 | 160: 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 .. ............. 317 | 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ................ 318 | 464: 04 03 17 17 73 65 76 65 6e 65 69 67 68 74 13 03 ....seveneight.. 319 | 480: 03 07 07 40 14 00 00 00 00 00 00 40 18 00 00 00 ...@.......@.... 320 | 496: 00 00 00 05 02 03 01 01 03 04 04 01 03 09 01 02 ................ 321 | page 3 offset 1024 322 | 0: 0d 00 00 00 08 01 54 00 01 f7 01 ec 01 c5 01 aa ......T......... 323 | 16: 01 a1 01 96 01 6f 01 54 00 00 00 00 00 00 00 00 .....o.T........ 324 | 112: 00 00 dd 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 325 | 336: 00 00 00 00 19 08 05 17 17 17 17 65 69 67 68 74 ...........eight 326 | 352: 65 69 67 68 74 73 65 76 65 6e 73 65 76 65 6e 25 eightsevenseven% 327 | 368: 07 05 07 07 07 07 40 18 00 00 00 00 00 00 40 18 ......@.......@. 328 | 384: 00 00 00 00 00 00 40 14 00 00 00 00 00 00 40 14 ......@.......@. 329 | 400: 00 00 00 00 00 00 09 06 05 01 01 01 01 04 04 03 ................ 330 | 416: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................ 331 | 432: 17 73 65 76 65 6e 65 69 67 68 74 65 69 67 68 74 .seveneighteight 332 | 448: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@... 333 | 464: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@... 334 | 480: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@........... 335 | 496: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................ 336 | page 4 offset 1536 337 | 0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................ 338 | 192: 00 00 00 00 00 00 7f 00 00 00 00 00 00 00 00 00 ................ 339 | 208: 00 e5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 340 | page 5 offset 2048 341 | 0: 0a 00 00 00 08 01 96 00 01 fa 01 c4 01 f2 01 bc ................ 342 | 16: 01 dc 01 a6 01 96 01 cc 00 00 00 00 00 00 00 00 ................ 343 | 240: 00 00 00 00 00 00 00 00 00 00 00 00 00 0e 00 00 ................ 344 | 400: 00 00 00 00 00 00 0f 04 17 07 01 65 69 67 68 74 ...........eight 345 | 416: 65 69 67 68 74 08 15 04 07 07 01 40 18 00 00 00 eight......@.... 346 | 432: 00 00 00 40 18 00 00 00 00 00 00 07 07 04 01 01 ...@............ 347 | 448: 01 04 04 06 07 04 01 01 01 02 02 05 0f 04 17 17 ................ 348 | 464: 01 73 65 76 65 6e 65 69 67 68 74 04 15 04 07 07 .seveneight..... 349 | 480: 01 40 14 00 00 00 00 00 00 40 18 00 00 00 00 00 .@.......@...... 350 | 496: 00 03 07 04 01 01 01 03 04 02 05 04 09 01 09 02 ................ 351 | page 6 offset 2560 352 | 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................ 353 | 464: 00 00 00 00 00 00 00 00 00 00 7f 00 00 00 00 00 ................ 354 | page 7 offset 3072 355 | 0: 0d 00 00 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec ................ 356 | 16: 01 e0 01 d4 01 cb 01 c2 00 00 00 00 00 00 00 00 ................ 357 | 448: 00 00 07 08 02 17 65 69 67 68 74 07 07 02 17 65 ......eight....e 358 | 464: 69 67 68 74 0a 06 02 07 40 18 00 00 00 00 00 00 ight....@....... 359 | 480: 0a 05 02 07 40 18 00 00 00 00 00 00 03 04 02 01 ....@........... 360 | 496: 04 03 03 02 01 04 03 02 02 01 02 03 01 02 01 02 ................ 361 | end x/c02.db 362 }] 363 } {} 364 365 extra_schema_checks 0 366 do_catchsql_test dbfuzz001-320 { 367 PRAGMA integrity_check; 368 } {1 {database disk image is malformed}} 369 370 do_catchsql_test dbfuzz001-330 { 371 DELETE FROM t3 WHERE x IN (SELECT x FROM t4); 372 } {1 {database disk image is malformed}} 373 extra_schema_checks 1 374 375 #------------------------------------------------------------------------- 376 reset_db 377 378 do_execsql_test dbfuzz001-430 { 379 CREATE TABLE t1(a INTEGER, b INT, c DEFAULT 0); 380 } 381 382 do_execsql_test dbfuzz001-420 { 383 PRAGMA locking_mode=EXCLUSIVE; 384 PRAGMA journal_mode = memory; 385 INSERT INTO t1 VALUES(1,2,3); 386 PRAGMA journal_mode=PERSIST; 387 } {exclusive memory persist} 388 389 do_execsql_test dbfuzz001-430 { 390 INSERT INTO t1 VALUES(4, 5, 6); 391 } 392 393 do_execsql_test dbfuzz001-440 { 394 PRAGMA journal_mode=MEMORY; 395 INSERT INTO t1 VALUES(7, 8, 9); 396 } {memory} 397 398 finish_test