1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Fix an assert() in memdbTruncate() that could fail when processing a corrupt database.

FossilOrigin-Name: b1e2929860557cf88f98f0a4f2472e1a16be126bbb8050f0d728350f0cfe987a
This commit is contained in:
dan
2021-11-08 15:46:08 +00:00
parent 6d64b4a027
commit 1a39e45619
4 changed files with 48 additions and 11 deletions

View File

@@ -229,4 +229,40 @@ ifcapable vtab {
} {1 {table t1 already exists}}
}
#-------------------------------------------------------------------------
# dbsqlfuzz 0a13dfb474d4f2f11a48a2ea57075c96fb456dd7
#
reset_db
do_execsql_test 800 {
PRAGMA autovacuum = 0;
PRAGMA page_size = 8192;
PRAGMA journal_mode = wal;
CREATE TABLE t1(x, y);
INSERT INTO t1 VALUES(1, 2);
CREATE TABLE t2(x, y);
} {wal}
db close
set fd [open test.db]
fconfigure $fd -translation binary -encoding binary
set data [read $fd [expr 20*1024]]
sqlite3 db ""
db deserialize $data
do_execsql_test 810 {
PRAGMA locking_mode = exclusive;
SELECT * FROM t1
} {exclusive 1 2}
do_execsql_test 820 {
INSERT INTO t1 VALUES(3, 4);
SELECT * FROM t1;
} {1 2 3 4}
do_catchsql_test 830 {
PRAGMA wal_checkpoint;
} {1 {database disk image is malformed}}
finish_test