From: danielk1977 Date: Tue, 8 Jul 2008 14:31:14 +0000 (+0000) Subject: Another corruption related test case. (CVS 5367) X-Git-Tag: version-3.6.10~810 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35af9ba095fcc4dfb899959c552156c49133c9a0;p=thirdparty%2Fsqlite.git Another corruption related test case. (CVS 5367) FossilOrigin-Name: f781a68127c97e30763447a12314180f0728deb9 --- diff --git a/manifest b/manifest index f8af8a29b0..bc4979dcba 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scompilation\sbug\swith\sSQLITE_OMIT_AUTOINIT.\s(CVS\s5366) -D 2008-07-08T14:17:35 +C Another\scorruption\srelated\stest\scase.\s(CVS\s5367) +D 2008-07-08T14:31:15 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -242,7 +242,7 @@ F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 087c42997754b8c648819832241daf724f813322 F test/conflict.test bb29b052c60a1f7eb6382be77902061d1f305318 F test/corrupt.test af069d971853dbe12af936910bfa49d92f7b16e9 -F test/corrupt2.test 30a89c762c3c6575b725711d1f260b42470002a6 +F test/corrupt2.test e4b03d9d4831cf0840a0f473281ab251b2f165f0 F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32 F test/corrupt4.test acdb01afaedf529004b70e55de1a6f5a05ae7fff F test/corrupt5.test 7796d5bdfe155ed824cee9dff371f49da237cfe0 @@ -600,7 +600,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 08334f60303e63b581fa7f1f00d3e8833f1710ca -R 8ac86c826f8b10e2f30647de3f8c697e +P 94c95fad56965b68176e93f0690f0819ad40bcf7 +R 44e2f1c0e8d85d0179e55f7050a50307 U danielk1977 -Z 600225b33fecb70d6a161959c7da01bc +Z 66c4a0a833d5a6c4eb7405af47a10264 diff --git a/manifest.uuid b/manifest.uuid index 95d8af7477..0cb1ef121a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -94c95fad56965b68176e93f0690f0819ad40bcf7 \ No newline at end of file +f781a68127c97e30763447a12314180f0728deb9 \ No newline at end of file diff --git a/test/corrupt2.test b/test/corrupt2.test index 82662a2457..eecb562c72 100644 --- a/test/corrupt2.test +++ b/test/corrupt2.test @@ -13,7 +13,7 @@ # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # -# $Id: corrupt2.test,v 1.10 2008/07/08 12:07:33 danielk1977 Exp $ +# $Id: corrupt2.test,v 1.11 2008/07/08 14:31:15 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -334,7 +334,35 @@ ifcapable autovacuum { } } {1 {database disk image is malformed}} } +} +corruption_test -sqlprep { + PRAGMA page_size = 1024; + CREATE TABLE t1(a INTEGER PRIMARY KEY, b); + CREATE INDEX i1 ON t1(b); + INSERT INTO t1 VALUES(1, randomblob(50)); + INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; + INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; + INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; + INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; + INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; + INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; +} -corrupt { + # Set the page-flags of one of the leaf pages of the index B-Tree to + # 0x0D (interpreted by SQLite as "leaf page of a table B-Tree"). + # + set fd [open corrupt.db r+] + fconfigure $fd -translation binary -encoding binary + seek $fd [expr 1024*2 + 8] + set zRightChild [read $fd 4] + binary scan $zRightChild I iRightChild + seek $fd [expr 1024*($iRightChild-1)] + puts -nonewline $fd "\x0D" + close $fd +} -test { + do_test corrupt2-7.1 { + catchsql { SELECT b FROM t1 ORDER BY b } + } {1 {database disk image is malformed}} } finish_test