sqlite/test/dbfuzz001.test
drh ca439a4967 Disable rootpage bounds checking when the SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS
setting is off, to facilitate reaching obscure error states during testing.

FossilOrigin-Name: d7dd4fc464c791915f646b1ad228697d1fa16f530fc7d0e9aa702c8df3068c65
2020-07-22 21:05:23 +00:00

375 lines
24 KiB
Plaintext

# 2012-12-13
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test cases for corrupt database files.
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !deserialize {
finish_test
return
}
database_may_be_corrupt
# In the following database file, there is 384 bytes of free space
# on page 8 that does not appear on the freeblock list.
#
do_test dbfuzz001-100 {
sqlite3 db {}
db deserialize [decode_hexdb {
| size 5632 pagesize 512 filename c4.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 02 00 01 01 00 40 20 20 00 00 00 02 00 00 00 0b .....@ ........
| 32: 00 00 00 06 00 00 00 01 00 00 00 28 00 00 00 04 ...........(....
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 ................
| 96: 00 2e 30 38 0d 00 00 00 06 01 06 00 01 da 01 b0 ..08............
| 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*..........
| 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta
| 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T
| 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*.....
| 304: 01 3f 69 6e 64 65 78 00 00 00 00 00 00 00 00 00 .?index.........
| 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein
| 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE
| 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t
| 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta
| 400: 62 6c 65 74 33 74 33 04 43 52 45 41 54 45 20 54 blet3t3.CREATE T
| 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f)
| 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t
| 448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 2.CREATE TABLE t
| 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$.....
| 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA
| 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b)
| page 2 offset 512
| 0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................
| page 3 offset 1024
| 0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................
| page 4 offset 1536
| 0: 05 00 00 00 03 01 f1 00 00 00 00 0b 01 fb 01 f6 ................
| 16: 01 f1 00 16 00 00 09 06 05 01 01 01 01 04 04 03 ................
| 32: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................
| 48: 17 73 65 76 65 6e 65 69 67 68 74 65 69 67 68 74 .seveneighteight
| 64: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@...
| 80: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@...
| 96: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@...........
| 112: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................
| 352: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1a ................
| 496: 00 00 00 00 0a 3e 00 00 00 09 21 00 00 00 08 06 .....>....!.....
| page 5 offset 2048
| 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................
| page 7 offset 3072
| 0: 0d 00 00 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec ................
| 16: 01 e0 01 d4 01 cb 01 c2 00 00 00 00 00 00 00 00 ................
| 96: 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 ................
| 224: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 ................
| 288: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 ................
| 448: 00 00 07 08 02 17 65 69 67 68 74 07 07 02 17 65 ......eight....e
| 464: 69 67 68 74 0a 06 02 07 40 18 00 00 00 00 00 00 ight....@.......
| 480: 0a 05 02 07 40 18 00 00 00 00 00 00 03 04 02 01 ....@...........
| 496: 04 03 03 02 01 04 03 02 02 01 02 03 01 02 01 02 ................
| page 8 offset 3584
| 0: 0d 00 21 00 01 00 16 00 00 16 00 16 00 16 00 16 ..!.............
| 16: 00 16 00 16 00 00 09 06 05 01 01 01 01 04 04 03 ................
| 32: 03 00 00 00 5f 01 09 09 02 02 00 00 00 56 17 17 ...._........V..
| 48: 17 73 65 76 65 6e 65 69 67 68 74 65 69 67 68 74 .seveneighteight
| 64: 73 65 76 65 6e 00 00 00 3b 07 07 07 40 14 00 00 seven...;...@...
| 80: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@...
| 96: 00 00 00 00 40 14 00 00 00 00 00 00 00 00 00 14 ....@...........
| 112: 01 01 01 03 04 04 03 00 00 00 09 01 01 09 02 02 ................
| 352: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1a ................
| page 9 offset 4096
| 0: 0d 00 00 00 1b 00 47 00 01 d9 01 be 01 af 01 a0 ......G.........
| 16: 01 91 01 82 01 73 01 64 01 55 01 46 01 37 01 28 .....s.d.U.F.7.(
| 32: 01 19 01 0a 00 fb 00 ec 00 dd 00 ce 00 bf 00 b0 ................
| 48: 00 a1 00 92 00 83 00 74 00 65 00 56 00 47 00 00 .......t.e.V.G..
| 64: 00 00 00 00 00 00 00 0d 21 00 00 48 01 54 00 01 ........!..H.T..
| 80: f7 01 ec 01 c5 01 0d 20 00 00 48 01 54 00 01 f7 ....... ..H.T...
| 96: 01 ec 01 c5 01 0d 1f 00 00 48 01 54 00 01 f7 01 .........H.T....
| 112: ec 01 c5 01 0d 1e 00 00 48 01 54 00 01 f7 01 ec ........H.T.....
| 128: 01 c5 01 0d 1d 00 00 48 01 54 00 01 f7 01 ec 01 .......H.T......
| 144: c5 01 0d 1c 00 00 48 01 54 00 01 f7 01 ec 01 c5 ......H.T.......
| 160: 01 0d 1b 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 .....H.T........
| 176: 0d 1a 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d ....H.T.........
| 192: 19 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 18 ...H.T..........
| 208: 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 17 00 ..H.T...........
| 224: 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 16 00 00 .H.T............
| 240: 48 01 54 00 01 f7 01 ec 01 c5 01 0d 15 00 00 48 H.T............H
| 256: 01 54 00 01 f7 01 ec 01 c5 01 0d 14 00 00 48 01 .T............H.
| 272: 54 00 01 f7 01 ec 01 c5 01 0d 13 00 00 48 01 54 T............H.T
| 288: 00 01 f7 01 ec 01 c5 01 0d 12 00 00 48 01 54 00 ............H.T.
| 304: 01 f7 01 ec 01 c5 01 0d 11 00 00 48 01 54 00 01 ...........H.T..
| 320: f7 01 ec 01 c5 01 0d 10 00 00 48 01 54 00 01 f7 ..........H.T...
| 336: 01 ec 01 c5 01 0d 0f 00 00 48 01 54 00 01 f7 01 .........H.T....
| 352: ec 01 c5 01 0d 0e 00 00 48 01 54 00 01 f7 01 ec ........H.T.....
| 368: 01 c5 01 0d 0d 00 00 48 01 54 00 01 f7 01 ec 01 .......H.T......
| 384: c5 01 0d 0c 00 00 48 01 54 00 01 f7 01 ec 01 c5 ......H.T.......
| 400: 01 0d 0b 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 .....H.T........
| 416: 0d 0a 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d ....H.T.........
| 432: 09 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 19 08 ...H.T..........
| 448: 05 17 17 17 17 65 69 67 68 74 65 69 67 68 74 73 .....eighteights
| 464: 65 76 65 6e 73 65 76 65 6e 25 07 05 07 07 07 07 evenseven%......
| 480: 40 18 00 00 00 00 00 00 40 18 00 00 00 00 00 00 @.......@.......
| 496: 40 14 00 00 00 00 00 00 40 14 00 00 00 00 00 00 @.......@.......
| page 10 offset 4608
| 0: 0d 00 00 00 1d 00 4d 00 01 f1 01 e2 01 d3 01 c4 ......M.........
| 16: 01 b5 01 a6 01 97 01 88 01 79 01 6a 01 5b 01 4c .........y.j.[.L
| 32: 01 3d 01 2e 01 1f 01 10 01 01 00 f2 00 e3 00 d4 .=..............
| 48: 00 c5 00 b6 00 a7 00 98 00 89 00 7a 00 6b 00 5c ...........z.k.\
| 64: 00 4d 00 00 00 00 00 00 00 00 00 00 00 0d 3e 00 .M............>.
| 80: 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 3d 00 00 .H.T.........=..
| 96: 48 01 54 00 01 f7 01 ec 01 c5 01 0d 3c 00 00 48 H.T.........<..H
| 112: 01 54 00 01 f7 01 ec 01 c5 01 0d 3b 00 00 48 01 .T.........;..H.
| 128: 54 00 01 f7 01 ec 01 c5 01 0d 3a 00 00 48 01 54 T.........:..H.T
| 144: 00 01 f7 01 ec 01 c5 01 0d 39 00 00 48 01 54 00 .........9..H.T.
| 160: 01 f7 01 ec 01 c5 01 0d 38 00 00 48 01 54 00 01 ........8..H.T..
| 176: f7 01 ec 01 c5 01 0d 37 00 00 48 01 54 00 01 f7 .......7..H.T...
| 192: 01 ec 01 c5 01 0d 36 00 00 48 01 54 00 01 f7 01 ......6..H.T....
| 208: ec 01 c5 01 0d 35 00 00 48 01 54 00 01 f7 01 ec .....5..H.T.....
| 224: 01 c5 01 0d 34 00 00 48 01 54 00 01 f7 01 ec 01 ....4..H.T......
| 240: c5 01 0d 33 00 00 48 01 54 00 01 f7 01 ec 01 c5 ...3..H.T.......
| 256: 01 0d 32 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 ..2..H.T........
| 272: 0d 31 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d .1..H.T.........
| 288: 30 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2f 0..H.T........./
| 304: 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2e 00 ..H.T...........
| 320: 00 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2d 00 00 .H.T.........-..
| 336: 48 01 54 00 01 f7 01 ec 01 c5 01 0d 2c 00 00 48 H.T.........,..H
| 352: 01 54 00 01 f7 01 ec 01 c5 01 0d 2b 00 00 48 01 .T.........+..H.
| 368: 54 00 01 f7 01 ec 01 c5 01 0d 2a 00 00 48 01 54 T.........*..H.T
| 384: 00 01 f7 01 ec 01 c5 01 0d 29 00 00 48 01 54 00 .........)..H.T.
| 400: 01 f7 01 ec 01 c5 01 0d 28 00 00 48 01 54 00 01 ........(..H.T..
| 416: f7 01 ec 01 c5 01 0d 27 00 00 48 01 54 00 01 f7 .......'..H.T...
| 432: 01 ec 01 c5 01 0d 26 00 00 48 01 54 00 01 f7 01 ......&..H.T....
| 448: ec 01 c5 01 0d 25 00 00 48 01 54 00 01 f7 01 ec .....%..H.T.....
| 464: 01 c5 01 0d 24 00 00 48 01 54 00 01 f7 01 ec 01 ....$..H.T......
| 480: c5 01 0d 23 00 00 48 01 54 00 01 f7 01 ec 01 c5 ...#..H.T.......
| 496: 01 0d 22 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 .."..H.T........
| page 11 offset 5120
| 0: 0d 00 00 00 0a 01 6a 00 01 f1 01 e2 01 d3 01 c4 ......j.........
| 16: 01 b5 01 a6 01 97 01 88 01 79 01 6a 00 00 00 00 .........y.j....
| 352: 00 00 00 00 00 00 00 00 00 00 0d 48 00 00 48 01 ...........H..H.
| 368: 54 00 01 f7 01 ec 01 c5 01 0d 47 00 00 48 01 54 T.........G..H.T
| 384: 00 01 f7 01 ec 01 c5 01 0d 46 00 00 48 01 54 00 .........F..H.T.
| 400: 01 f7 01 ec 01 c5 01 0d 45 00 00 48 01 54 00 01 ........E..H.T..
| 416: f7 01 ec 01 c5 01 0d 44 00 00 48 01 54 00 01 f7 .......D..H.T...
| 432: 01 ec 01 c5 01 0d 43 00 00 48 01 54 00 01 f7 01 ......C..H.T....
| 448: ec 01 c5 01 0d 42 00 00 48 01 54 00 01 f7 01 ec .....B..H.T.....
| 464: 01 c5 01 0d 41 00 00 48 01 54 00 01 f7 01 ec 01 ....A..H.T......
| 480: c5 01 0d 40 00 00 48 01 54 00 01 f7 01 ec 01 c5 ...@..H.T.......
| 496: 01 0d 3f 00 00 48 01 54 00 01 f7 01 ec 01 c5 01 ..?..H.T........
| end c4.db
}]
} {}
ifcapable !oversize_cell_check {
# Non SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds:
do_test dbfuzz001-101a {
db eval {PRAGMA writable_schema=on; PRAGMA integrity_check}
} {/Fragmentation of 384 bytes reported as 0 on page 8/}
} else {
# SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds:
do_catchsql_test dbfuzz001-101b {
PRAGMA writable_schema=on;
PRAGMA integrity_check;
} {1 {database disk image is malformed}}
}
# The DELETE query below deletes the very last cell from page 8.
# Prior to a certain fix to sqlite3BtreeDelete() and because of the
# corruption to the freeblock list on page 8, this would fail to
# cause a rebalance operation, which would leave the btree in a weird
# state that would lead to segfaults and or assertion faults.
#
do_execsql_test dbfuzz001-110 {
DELETE FROM t3 WHERE x IS NOT NULL AND +rowid=6;
} {}
# This is a dbfuzz2-generate test case that can cause a page with
# pPage->nCell==0 to enter the balancer.
#
do_test dbfuzz001-200 {
db deserialize [decode_hexdb {
| size 3076 pagesize 512 filename c03.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 02 00 01 01 00 40 20 20 00 00 00 0c 00 00 00 07 .....@ ........
| 32: 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 04 ................
| 48: 00 00 00 00 00 00 00 03 e8 00 00 01 00 00 00 00 ................
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c ................
| 96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0 ..,P............
| 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*..........
| 128: 00 00 00 00 00 00 00 00 ef 00 00 00 00 00 00 00 ................
| 192: 00 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 224: 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e9 00 ................
| 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta
| 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T
| 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*.....
| 304: 01 3f 69 6e 64 65 78 74 33 78 74 33 06 43 52 45 .?indext3xt3.CRE
| 320: 41 54 45 20 49 4e 44 45 58 20 74 33 64 20 4f 4e ATE INDEX t3d ON
| 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein
| 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE
| 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t
| 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta
| 400: 62 6c 65 74 33 74 33 04 43 52 45 41 54 45 20 54 blet3t3.CREATE T
| 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f)
| 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t
| 448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 2.CREATE TABLE t
| 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$.....
| 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA
| 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b)
| page 2 offset 512
| 0: 0d 00 00 00 04 01 cf 00 01 fa 01 f3 01 de 01 cf ................
| 176: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 256: 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 368: 00 00 00 00 00 00 00 00 00 00 00 00 1e 00 00 00 ................
| 416: 00 00 00 1b 00 00 00 00 04 00 00 00 00 00 00 00 ................
| 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ................
| 464: 04 03 17 17 73 65 76 65 6e 65 69 67 68 74 13 03 ....seveneight..
| 480: 03 07 07 40 14 00 00 00 00 00 00 40 18 00 00 00 ...@.......@....
| 496: 00 00 00 05 02 03 01 01 03 04 04 01 03 09 01 02 ................
| page 3 offset 1024
| 0: 0d 00 00 00 08 01 54 00 01 f7 01 ec 01 c5 01 aa ......T.........
| 16: 01 a1 01 96 01 6f 01 54 00 00 00 00 00 00 00 00 .....o.T........
| 32: 00 00 00 00 00 00 00 03 e8 00 00 00 00 00 00 00 ................
| 336: 00 00 00 00 19 08 05 16 17 17 17 65 69 67 68 74 ...........eight
| 352: 65 69 67 68 74 73 65 76 65 6e 73 65 76 ff ff ff eightsevensev...
| 368: 0e 05 07 07 07 07 40 18 00 00 00 00 00 00 40 18 ......@.......@.
| 384: 00 00 00 00 00 00 40 14 00 00 00 00 00 00 40 14 ......@.......@.
| 400: 00 00 00 00 00 00 09 06 05 01 01 01 01 04 04 03 ................
| 416: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................
| 432: 17 73 65 6f 65 6e 65 69 67 68 74 65 69 67 68 74 .seoeneighteight
| 448: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@...
| 464: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@...
| 480: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@...........
| 496: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................
| page 4 offset 1536
| 0: 0d 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 ................
| 160: 00 00 00 ea 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 336: 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 ............ ...
| page 5 offset 2048
| 0: 0a 00 00 00 08 01 96 00 01 fa 01 c4 01 f2 01 bc ................
| 16: 01 dc 01 a6 01 96 01 cc 00 00 00 00 00 00 00 00 ................
| 48: 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 ................
| 288: 00 00 00 00 00 00 00 00 00 64 00 00 00 2b 00 00 .........d...+..
| 400: 00 00 00 00 00 00 0f 04 17 17 01 65 69 67 68 74 ...........eight
| 416: 65 69 6f 68 74 08 15 04 07 07 01 40 18 00 00 00 eioht......@....
| 432: 00 00 00 40 18 00 00 00 00 00 00 07 07 04 01 01 ...@............
| 448: 01 04 04 06 07 04 01 01 01 02 02 05 0f 04 17 17 ................
| 464: 01 73 65 76 65 6e 65 69 67 68 74 04 15 04 07 07 .seveneight.....
| 480: 01 40 14 00 00 00 00 00 00 40 18 00 00 00 00 00 .@.......@......
| 496: 00 03 07 04 01 01 01 03 04 02 05 04 09 01 09 02 ................
| page 6 offset 2560
| 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 0d 00 00 ................
| 16: 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec 01 e0 01 ................
| 32: d4 01 cb 01 c2 00 00 00 00 00 00 00 00 00 00 00 ................
| 160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 ................
| 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 ................
| 464: 08 02 17 65 69 67 68 74 07 07 02 17 65 69 67 68 ...eight....eigh
| 480: 74 0a 06 02 07 40 18 00 00 00 00 00 00 0a 05 02 t....@..........
| 496: 07 40 18 00 04 02 01 04 03 03 02 01 04 03 02 02 .@..............
| end x/c03.db
}]
catchsql {INSERT INTO t3 SELECT * FROM t2;}
} {1 {database disk image is malformed}}
do_test dbfuzz001-310 {
sqlite3 db {}
db deserialize [decode_hexdb {
| size 3584 pagesize 512 filename x/c02.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 02 00 01 01 00 40 20 20 00 00 00 0c 00 00 00 07 .....@ ........
| 32: 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 04 ................
| 48: 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 00 ................
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c ................
| 96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0 ..,P............
| 112: 01 56 01 86 01 2a 01 06 00 00 00 00 00 00 00 00 .V...*..........
| 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 31 74 61 ......"......1ta
| 272: 62 6c 65 74 34 74 34 07 43 52 45 41 54 45 20 54 blet4t4.CREATE T
| 288: 41 42 4c 45 20 74 34 28 78 29 2a 06 06 17 13 11 ABLE t4(x)*.....
| 304: 01 3f 69 6e 64 65 78 74 33 78 74 33 05 43 52 45 .?indext3xt3.CRE
| 320: 41 54 45 20 49 4e 44 45 58 20 74 33 78 20 4f 4e ATE INDEX t3x ON
| 336: 20 74 33 28 78 29 2e 04 06 17 15 11 01 45 69 6e t3(x).......Ein
| 352: 64 65 78 74 32 63 64 74 32 05 43 52 45 41 54 45 dext2cdt2.CREATE
| 368: 20 49 4e 44 45 58 20 74 32 63 64 20 4f 4e 20 74 INDEX t2cd ON t
| 384: 32 28 63 2c 64 29 28 05 06 17 11 11 01 3d 74 61 2(c,d)(......=ta
| 400: 62 6c 65 74 33 74 33 07 43 52 45 41 54 45 20 54 blet3t3.CREATE T
| 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f)
| 432: 28 02 06 17 11 11 01 3d 74 61 62 6c 65 74 32 74 (......=tablet2t
| 448: 32 32 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 22CREATE TABLE t
| 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$.....
| 480: 01 35 74 61 62 6c 65 74 31 74 31 02 43 52 45 41 .5tablet1t1.CREA
| 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b)
| page 2 offset 512
| 0: 0d 00 00 00 04 01 cf 00 01 fa 01 f3 01 de 01 cf ................
| 160: 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 .. .............
| 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ................
| 464: 04 03 17 17 73 65 76 65 6e 65 69 67 68 74 13 03 ....seveneight..
| 480: 03 07 07 40 14 00 00 00 00 00 00 40 18 00 00 00 ...@.......@....
| 496: 00 00 00 05 02 03 01 01 03 04 04 01 03 09 01 02 ................
| page 3 offset 1024
| 0: 0d 00 00 00 08 01 54 00 01 f7 01 ec 01 c5 01 aa ......T.........
| 16: 01 a1 01 96 01 6f 01 54 00 00 00 00 00 00 00 00 .....o.T........
| 112: 00 00 dd 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 336: 00 00 00 00 19 08 05 17 17 17 17 65 69 67 68 74 ...........eight
| 352: 65 69 67 68 74 73 65 76 65 6e 73 65 76 65 6e 25 eightsevenseven%
| 368: 07 05 07 07 07 07 40 18 00 00 00 00 00 00 40 18 ......@.......@.
| 384: 00 00 00 00 00 00 40 14 00 00 00 00 00 00 40 14 ......@.......@.
| 400: 00 00 00 00 00 00 09 06 05 01 01 01 01 04 04 03 ................
| 416: 03 07 05 05 01 01 09 09 02 02 19 04 05 17 17 17 ................
| 432: 17 73 65 76 65 6e 65 69 67 68 74 65 69 67 68 74 .seveneighteight
| 448: 73 65 76 65 6e 25 03 05 07 07 07 07 40 14 00 00 seven%......@...
| 464: 00 00 00 00 40 18 00 00 00 00 00 00 40 18 00 00 ....@.......@...
| 480: 00 00 00 00 40 14 00 00 00 00 00 00 09 02 05 01 ....@...........
| 496: 01 01 01 03 04 04 03 07 01 05 09 01 01 09 02 02 ................
| page 4 offset 1536
| 0: 0d 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................
| 192: 00 00 00 00 00 00 7f 00 00 00 00 00 00 00 00 00 ................
| 208: 00 e5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| page 5 offset 2048
| 0: 0a 00 00 00 08 01 96 00 01 fa 01 c4 01 f2 01 bc ................
| 16: 01 dc 01 a6 01 96 01 cc 00 00 00 00 00 00 00 00 ................
| 240: 00 00 00 00 00 00 00 00 00 00 00 00 00 0e 00 00 ................
| 400: 00 00 00 00 00 00 0f 04 17 07 01 65 69 67 68 74 ...........eight
| 416: 65 69 67 68 74 08 15 04 07 07 01 40 18 00 00 00 eight......@....
| 432: 00 00 00 40 18 00 00 00 00 00 00 07 07 04 01 01 ...@............
| 448: 01 04 04 06 07 04 01 01 01 02 02 05 0f 04 17 17 ................
| 464: 01 73 65 76 65 6e 65 69 67 68 74 04 15 04 07 07 .seveneight.....
| 480: 01 40 14 00 00 00 00 00 00 40 18 00 00 00 00 00 .@.......@......
| 496: 00 03 07 04 01 01 01 03 04 02 05 04 09 01 09 02 ................
| page 6 offset 2560
| 0: 0a 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 ................
| 464: 00 00 00 00 00 00 00 00 00 00 7f 00 00 00 00 00 ................
| page 7 offset 3072
| 0: 0d 00 00 00 08 01 c2 00 01 fb 01 f6 01 f1 01 ec ................
| 16: 01 e0 01 d4 01 cb 01 c2 00 00 00 00 00 00 00 00 ................
| 448: 00 00 07 08 02 17 65 69 67 68 74 07 07 02 17 65 ......eight....e
| 464: 69 67 68 74 0a 06 02 07 40 18 00 00 00 00 00 00 ight....@.......
| 480: 0a 05 02 07 40 18 00 00 00 00 00 00 03 04 02 01 ....@...........
| 496: 04 03 03 02 01 04 03 02 02 01 02 03 01 02 01 02 ................
| end x/c02.db
}]
} {}
extra_schema_checks 0
do_catchsql_test dbfuzz001-320 {
PRAGMA integrity_check;
} {1 {database disk image is malformed}}
do_catchsql_test dbfuzz001-330 {
DELETE FROM t3 WHERE x IN (SELECT x FROM t4);
} {1 {database disk image is malformed}}
extra_schema_checks 1
finish_test