-C Improved\sNaN\stesting\sfor\shighly\soptimized\sGCC\son\sx86.\nTickets\s#3202\sand\s#3194.\s(CVS\s5396)
-D 2008-07-11T16:19:10
+C Added\scorruptA.test\sfor\stesting\smalformed\sdatabase\sheaders.\s(CVS\s5397)
+D 2008-07-11T16:39:23
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
-F src/btree.c 881d5eb6ec2a80421690537e68e63a91644bf3ef
+F src/btree.c 8d08214728e231ba9ee2753bb224abbfddad6a6c
F src/btree.h 0063e9853aa1ffb55b46f0e798eea8934f032ffd
F src/btreeInt.h d59e58d39950a17c0fb7e004c90ab7696d3e7df5
F src/build.c bac7233d984be3805aaa41cf500f7ee12dc97249
F test/corrupt7.test f0ff354eb2f0a23035fbd06724b87cac95b55cc1
F test/corrupt8.test 9992ef7f67cefc576b92373f6bf5ab8775280f51
F test/corrupt9.test 2a1bf91834dc6f7adead1a4fabb5887393147dc6
+F test/corruptA.test 99e95620b980161cb3e79f06a884a4bb8ae265ff
F test/crash.test 1b6ac8410689ff78028887f445062dc897c9ac89
F test/crash2.test 26d7a4c5520201e5de2c696ea51ab946b59dc0e9
F test/crash3.test 0b09687ae1a3ccbcefdfaeb4b963e26e36255d76
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P d7e2f0d2d45574d6191c1b191c0daf5260696f27
-R ade8ff6c2fb33021086110407ad75d8e
+P a8a2fe45b21b405bb871e29540f98086b0c8f828
+R 99c674837ae34581b962ad7a0bf551b9
U drh
-Z 3b1b5d42552a23c609e4387817e377c9
+Z 9624bae6ebc6fc022ace1d7054a234f6
-a8a2fe45b21b405bb871e29540f98086b0c8f828
\ No newline at end of file
+6dcce6b9748c6148a768a4f6b69f33f70edc3993
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.479 2008/07/11 16:15:18 drh Exp $
+** $Id: btree.c,v 1.480 2008/07/11 16:39:23 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
pBt->minLocal = (pBt->usableSize-12)*32/255 - 23;
pBt->maxLeaf = pBt->usableSize - 35;
pBt->minLeaf = (pBt->usableSize-12)*32/255 - 23;
- if( pBt->minLocal>pBt->maxLocal || pBt->maxLocal<0 ){
- goto page1_init_failed;
- }
assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
pBt->pPage1 = pPage1;
return SQLITE_OK;
--- /dev/null
+# 2008 July 11
+#
+# 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+# This file implements tests to make sure SQLite does not crash or
+# segfault if it sees a corrupt database file. It specifically focuses
+# on corrupt database headers.
+#
+# $Id: corruptA.test,v 1.1 2008/07/11 16:39:23 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+
+# Create a database to work with.
+#
+do_test corruptA-1.1 {
+ execsql {
+ CREATE TABLE t1(x);
+ INSERT INTO t1(x) VALUES(1);
+ }
+ expr {[file size test.db]>=1024}
+} {1}
+integrity_check corruptA-1.2
+
+# Corrupt the file header in various ways and make sure the corruption
+# is detected when opening the database file.
+#
+db close
+file copy -force test.db test.db-template
+
+do_test corruptA-2.1 {
+ file copy -force test.db-template test.db
+ hexio_write test.db 19 02 ;# the read format number
+ sqlite3 db test.db
+ catchsql {SELECT * FROM t1}
+} {1 {file is encrypted or is not a database}}
+
+do_test corruptA-2.2 {
+ db close
+ file copy -force test.db-template test.db
+ hexio_write test.db 21 41 ;# max embedded payload fraction
+ sqlite3 db test.db
+ catchsql {SELECT * FROM t1}
+} {1 {file is encrypted or is not a database}}
+
+do_test corruptA-2.3 {
+ db close
+ file copy -force test.db-template test.db
+ hexio_write test.db 22 1f ;# min embedded payload fraction
+ sqlite3 db test.db
+ catchsql {SELECT * FROM t1}
+} {1 {file is encrypted or is not a database}}
+
+do_test corruptA-2.4 {
+ db close
+ file copy -force test.db-template test.db
+ hexio_write test.db 23 21 ;# min leaf payload fraction
+ sqlite3 db test.db
+ catchsql {SELECT * FROM t1}
+} {1 {file is encrypted or is not a database}}
+
+
+finish_test