1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Cover a corrupt-db case in pager.c. (CVS 3794)

FossilOrigin-Name: 84077fa1602756339a262bc4ab51b6b487edc637
This commit is contained in:
danielk1977
2007-04-02 12:28:27 +00:00
parent a55ca9e109
commit ead8e3f45e
3 changed files with 37 additions and 11 deletions

View File

@ -10,7 +10,7 @@
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: misc7.test,v 1.11 2007/04/02 11:08:59 danielk1977 Exp $
# $Id: misc7.test,v 1.12 2007/04/02 12:28:28 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -361,10 +361,12 @@ do_test misc7-17.1 {
COMMIT;
}
db close
copy_file bak.db test.db
copy_file bak.db-journal test.db-journal
file attributes test.db-journal -permissions r--------
sqlite3 db test.db
file attributes test.db-journal -permissions r--------
catchsql {
SELECT count(*) FROM t3;
}
@ -374,6 +376,30 @@ do_test misc7-17.2 {
catchsql {
SELECT count(*) FROM t3;
}
} {0 28}
} {0 32}
set ::pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1]
do_test misc7-17.3 {
db eval {
pragma writable_schema = true;
UPDATE sqlite_master
SET rootpage = $pending_byte_page
WHERE type = 'table' AND name = 't3';
}
execsql {
SELECT rootpage FROM sqlite_master WHERE type = 'table' AND name = 't3';
}
} $::pending_byte_page
do_test misc7-17.4 {
db close
sqlite3 db test.db
catchsql {
SELECT count(*) FROM t3;
}
} {1 {database disk image is malformed}}
db close
file delete -force test.db
finish_test