corrupt2.test 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. # 2004 August 30
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. # This file implements regression tests for SQLite library.
  12. #
  13. # This file implements tests to make sure SQLite does not crash or
  14. # segfault if it sees a corrupt database file.
  15. #
  16. # $Id: corrupt2.test,v 1.20 2009/04/06 17:50:03 danielk1977 Exp $
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. # Do not use a codec for tests in this file, as the database file is
  20. # manipulated directly using tcl scripts (using the [hexio_write] command).
  21. #
  22. do_not_use_codec
  23. set presql ""
  24. catch { set presql "$::G(perm:presql);" }
  25. unset -nocomplain ::G(perm:presql)
  26. # The following tests - corrupt2-1.* - create some databases corrupted in
  27. # specific ways and ensure that SQLite detects them as corrupt.
  28. #
  29. do_test corrupt2-1.1 {
  30. execsql {
  31. PRAGMA auto_vacuum=0;
  32. PRAGMA page_size=1024;
  33. CREATE TABLE abc(a, b, c);
  34. }
  35. } {}
  36. do_test corrupt2-1.2 {
  37. # Corrupt the 16 byte magic string at the start of the file
  38. forcedelete corrupt.db
  39. forcedelete corrupt.db-journal
  40. forcecopy test.db corrupt.db
  41. set f [open corrupt.db RDWR]
  42. seek $f 8 start
  43. puts $f blah
  44. close $f
  45. sqlite3 db2 corrupt.db
  46. catchsql "
  47. $::presql
  48. SELECT * FROM sqlite_master;
  49. " db2
  50. } {1 {file is encrypted or is not a database}}
  51. do_test corrupt2-1.3 {
  52. db2 close
  53. # Corrupt the page-size (bytes 16 and 17 of page 1).
  54. forcedelete corrupt.db
  55. forcedelete corrupt.db-journal
  56. forcecopy test.db corrupt.db
  57. set f [open corrupt.db RDWR]
  58. fconfigure $f -encoding binary
  59. seek $f 16 start
  60. puts -nonewline $f "\x00\xFF"
  61. close $f
  62. sqlite3 db2 corrupt.db
  63. catchsql "
  64. $::presql
  65. SELECT * FROM sqlite_master;
  66. " db2
  67. } {1 {file is encrypted or is not a database}}
  68. do_test corrupt2-1.4 {
  69. db2 close
  70. # Corrupt the free-block list on page 1.
  71. forcedelete corrupt.db
  72. forcedelete corrupt.db-journal
  73. forcecopy test.db corrupt.db
  74. set f [open corrupt.db RDWR]
  75. fconfigure $f -encoding binary
  76. seek $f 101 start
  77. puts -nonewline $f "\xFF\xFF"
  78. close $f
  79. sqlite3 db2 corrupt.db
  80. catchsql "
  81. $::presql
  82. SELECT * FROM sqlite_master;
  83. " db2
  84. } {1 {database disk image is malformed}}
  85. do_test corrupt2-1.5 {
  86. db2 close
  87. # Corrupt the free-block list on page 1.
  88. forcedelete corrupt.db
  89. forcedelete corrupt.db-journal
  90. forcecopy test.db corrupt.db
  91. set f [open corrupt.db RDWR]
  92. fconfigure $f -encoding binary
  93. seek $f 101 start
  94. puts -nonewline $f "\x00\xC8"
  95. seek $f 200 start
  96. puts -nonewline $f "\x00\x00"
  97. puts -nonewline $f "\x10\x00"
  98. close $f
  99. sqlite3 db2 corrupt.db
  100. catchsql "
  101. $::presql
  102. SELECT * FROM sqlite_master;
  103. " db2
  104. } {1 {database disk image is malformed}}
  105. db2 close
  106. # Corrupt a database by having 2 indices of the same name:
  107. do_test corrupt2-2.1 {
  108. forcedelete corrupt.db
  109. forcedelete corrupt.db-journal
  110. forcecopy test.db corrupt.db
  111. sqlite3 db2 corrupt.db
  112. execsql "
  113. $::presql
  114. CREATE INDEX a1 ON abc(a);
  115. CREATE INDEX a2 ON abc(b);
  116. PRAGMA writable_schema = 1;
  117. UPDATE sqlite_master
  118. SET name = 'a3', sql = 'CREATE INDEX a3' || substr(sql, 16, 10000)
  119. WHERE type = 'index';
  120. PRAGMA writable_schema = 0;
  121. " db2
  122. db2 close
  123. sqlite3 db2 corrupt.db
  124. catchsql "
  125. $::presql
  126. SELECT * FROM sqlite_master;
  127. " db2
  128. } {1 {malformed database schema (a3) - index a3 already exists}}
  129. db2 close
  130. do_test corrupt2-3.1 {
  131. forcedelete corrupt.db
  132. forcedelete corrupt.db-journal
  133. sqlite3 db2 corrupt.db
  134. execsql "
  135. $::presql
  136. PRAGMA auto_vacuum = 1;
  137. PRAGMA page_size = 1024;
  138. CREATE TABLE t1(a, b, c);
  139. CREATE TABLE t2(a, b, c);
  140. INSERT INTO t2 VALUES(randomblob(100), randomblob(100), randomblob(100));
  141. INSERT INTO t2 SELECT * FROM t2;
  142. INSERT INTO t2 SELECT * FROM t2;
  143. INSERT INTO t2 SELECT * FROM t2;
  144. INSERT INTO t2 SELECT * FROM t2;
  145. " db2
  146. db2 close
  147. # On the root page of table t2 (page 4), set one of the child page-numbers
  148. # to 0. This corruption will be detected when SQLite attempts to update
  149. # the pointer-map after moving the content of page 4 to page 3 as part
  150. # of the DROP TABLE operation below.
  151. #
  152. set fd [open corrupt.db r+]
  153. fconfigure $fd -encoding binary -translation binary
  154. seek $fd [expr 1024*3 + 12]
  155. set zCelloffset [read $fd 2]
  156. binary scan $zCelloffset S iCelloffset
  157. seek $fd [expr 1024*3 + $iCelloffset]
  158. puts -nonewline $fd "\00\00\00\00"
  159. close $fd
  160. sqlite3 db2 corrupt.db
  161. catchsql "
  162. $::presql
  163. DROP TABLE t1;
  164. " db2
  165. } {1 {database disk image is malformed}}
  166. do_test corrupt2-4.1 {
  167. catchsql {
  168. SELECT * FROM t2;
  169. } db2
  170. } {1 {database disk image is malformed}}
  171. db2 close
  172. unset -nocomplain result
  173. do_test corrupt2-5.1 {
  174. forcedelete corrupt.db
  175. forcedelete corrupt.db-journal
  176. sqlite3 db2 corrupt.db
  177. execsql "
  178. $::presql
  179. PRAGMA auto_vacuum = 0;
  180. PRAGMA page_size = 1024;
  181. CREATE TABLE t1(a, b, c);
  182. CREATE TABLE t2(a, b, c);
  183. INSERT INTO t2 VALUES(randomblob(100), randomblob(100), randomblob(100));
  184. INSERT INTO t2 SELECT * FROM t2;
  185. INSERT INTO t2 SELECT * FROM t2;
  186. INSERT INTO t2 SELECT * FROM t2;
  187. INSERT INTO t2 SELECT * FROM t2;
  188. INSERT INTO t1 SELECT * FROM t2;
  189. " db2
  190. db2 close
  191. # This block links a page from table t2 into the t1 table structure.
  192. #
  193. set fd [open corrupt.db r+]
  194. fconfigure $fd -encoding binary -translation binary
  195. seek $fd [expr 1024 + 12]
  196. set zCelloffset [read $fd 2]
  197. binary scan $zCelloffset S iCelloffset
  198. seek $fd [expr 1024 + $iCelloffset]
  199. set zChildPage [read $fd 4]
  200. seek $fd [expr 2*1024 + 12]
  201. set zCelloffset [read $fd 2]
  202. binary scan $zCelloffset S iCelloffset
  203. seek $fd [expr 2*1024 + $iCelloffset]
  204. puts -nonewline $fd $zChildPage
  205. close $fd
  206. sqlite3 db2 corrupt.db
  207. db2 eval $::presql
  208. db2 eval {SELECT rowid FROM t1} {
  209. set result [db2 eval {pragma integrity_check}]
  210. break
  211. }
  212. set result
  213. } {{*** in database main ***
  214. On tree page 2 cell 0: 2nd reference to page 10
  215. On tree page 2 cell 1: Child page depth differs
  216. Page 4 is never used}}
  217. db2 close
  218. proc corruption_test {args} {
  219. set A(-corrupt) {}
  220. set A(-sqlprep) {}
  221. set A(-tclprep) {}
  222. array set A $args
  223. catch {db close}
  224. forcedelete corrupt.db
  225. forcedelete corrupt.db-journal
  226. sqlite3 db corrupt.db
  227. db eval $::presql
  228. eval $A(-tclprep)
  229. db eval $A(-sqlprep)
  230. db close
  231. eval $A(-corrupt)
  232. sqlite3 db corrupt.db
  233. eval $A(-test)
  234. }
  235. ifcapable autovacuum {
  236. # The tests within this block - corrupt2-6.* - aim to test corruption
  237. # detection within an incremental-vacuum. When an incremental-vacuum
  238. # step is executed, the last non-free page of the database file is
  239. # moved into a free space in the body of the file. After doing so,
  240. # the page reference in the parent page must be updated to refer
  241. # to the new location. These tests test the outcome of corrupting
  242. # that page reference before performing the incremental vacuum.
  243. #
  244. # The last page in the database page is the second page
  245. # in an overflow chain.
  246. #
  247. corruption_test -sqlprep {
  248. PRAGMA auto_vacuum = incremental;
  249. PRAGMA page_size = 1024;
  250. CREATE TABLE t1(a, b);
  251. INSERT INTO t1 VALUES(1, randomblob(2500));
  252. INSERT INTO t1 VALUES(2, randomblob(2500));
  253. DELETE FROM t1 WHERE a = 1;
  254. } -corrupt {
  255. hexio_write corrupt.db [expr 1024*5] 00000008
  256. } -test {
  257. do_test corrupt2-6.1 {
  258. catchsql " $::presql pragma incremental_vacuum = 1 "
  259. } {1 {database disk image is malformed}}
  260. }
  261. # The last page in the database page is a non-root b-tree page.
  262. #
  263. corruption_test -sqlprep {
  264. PRAGMA auto_vacuum = incremental;
  265. PRAGMA page_size = 1024;
  266. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  267. INSERT INTO t1 VALUES(1, randomblob(2500));
  268. INSERT INTO t1 VALUES(2, randomblob(50));
  269. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  270. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  271. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  272. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  273. DELETE FROM t1 WHERE a = 1;
  274. } -corrupt {
  275. hexio_write corrupt.db [expr 1024*2 + 8] 00000009
  276. } -test {
  277. do_test corrupt2-6.2 {
  278. catchsql " $::presql pragma incremental_vacuum = 1 "
  279. } {1 {database disk image is malformed}}
  280. }
  281. # Set up a pointer-map entry so that the last page of the database
  282. # file appears to be a b-tree root page. This should be detected
  283. # as corruption.
  284. #
  285. corruption_test -sqlprep {
  286. PRAGMA auto_vacuum = incremental;
  287. PRAGMA page_size = 1024;
  288. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  289. INSERT INTO t1 VALUES(1, randomblob(2500));
  290. INSERT INTO t1 VALUES(2, randomblob(2500));
  291. INSERT INTO t1 VALUES(3, randomblob(2500));
  292. DELETE FROM t1 WHERE a = 1;
  293. } -corrupt {
  294. set nPage [expr [file size corrupt.db] / 1024]
  295. hexio_write corrupt.db [expr 1024 + ($nPage-3)*5] 010000000
  296. } -test {
  297. do_test corrupt2-6.3 {
  298. catchsql " $::presql pragma incremental_vacuum = 1 "
  299. } {1 {database disk image is malformed}}
  300. }
  301. corruption_test -sqlprep {
  302. PRAGMA auto_vacuum = 1;
  303. PRAGMA page_size = 1024;
  304. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  305. INSERT INTO t1 VALUES(1, randomblob(2500));
  306. DELETE FROM t1 WHERE a = 1;
  307. } -corrupt {
  308. set nAppend [expr 1024*207 - [file size corrupt.db]]
  309. set fd [open corrupt.db r+]
  310. seek $fd 0 end
  311. puts -nonewline $fd [string repeat x $nAppend]
  312. close $fd
  313. hexio_write corrupt.db 28 00000000
  314. } -test {
  315. do_test corrupt2-6.4 {
  316. catchsql "
  317. $::presql
  318. BEGIN EXCLUSIVE;
  319. COMMIT;
  320. "
  321. } {1 {database disk image is malformed}}
  322. }
  323. }
  324. set sqlprep {
  325. PRAGMA auto_vacuum = 0;
  326. PRAGMA page_size = 1024;
  327. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  328. CREATE INDEX i1 ON t1(b);
  329. INSERT INTO t1 VALUES(1, randomblob(50));
  330. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  331. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  332. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  333. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  334. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  335. INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1;
  336. }
  337. corruption_test -sqlprep $sqlprep -corrupt {
  338. # Set the page-flags of one of the leaf pages of the index B-Tree to
  339. # 0x0D (interpreted by SQLite as "leaf page of a table B-Tree").
  340. #
  341. set fd [open corrupt.db r+]
  342. fconfigure $fd -translation binary -encoding binary
  343. seek $fd [expr 1024*2 + 8]
  344. set zRightChild [read $fd 4]
  345. binary scan $zRightChild I iRightChild
  346. seek $fd [expr 1024*($iRightChild-1)]
  347. puts -nonewline $fd "\x0D"
  348. close $fd
  349. } -test {
  350. do_test corrupt2-7.1 {
  351. catchsql " $::presql SELECT b FROM t1 ORDER BY b ASC "
  352. } {1 {database disk image is malformed}}
  353. }
  354. corruption_test -sqlprep $sqlprep -corrupt {
  355. # Mess up the page-header of one of the leaf pages of the index B-Tree.
  356. # The corruption is detected as part of an OP_Prev opcode.
  357. #
  358. set fd [open corrupt.db r+]
  359. fconfigure $fd -translation binary -encoding binary
  360. seek $fd [expr 1024*2 + 12]
  361. set zCellOffset [read $fd 2]
  362. binary scan $zCellOffset S iCellOffset
  363. seek $fd [expr 1024*2 + $iCellOffset]
  364. set zChild [read $fd 4]
  365. binary scan $zChild I iChild
  366. seek $fd [expr 1024*($iChild-1)+3]
  367. puts -nonewline $fd "\xFFFF"
  368. close $fd
  369. } -test {
  370. do_test corrupt2-7.1 {
  371. catchsql " $::presql SELECT b FROM t1 ORDER BY b DESC "
  372. } {1 {database disk image is malformed}}
  373. }
  374. corruption_test -sqlprep $sqlprep -corrupt {
  375. # Set the page-flags of one of the leaf pages of the table B-Tree to
  376. # 0x0A (interpreted by SQLite as "leaf page of an index B-Tree").
  377. #
  378. set fd [open corrupt.db r+]
  379. fconfigure $fd -translation binary -encoding binary
  380. seek $fd [expr 1024*1 + 8]
  381. set zRightChild [read $fd 4]
  382. binary scan $zRightChild I iRightChild
  383. seek $fd [expr 1024*($iRightChild-1)]
  384. puts -nonewline $fd "\x0A"
  385. close $fd
  386. } -test {
  387. do_test corrupt2-8.1 {
  388. catchsql " $::presql SELECT * FROM t1 WHERE rowid=1000 "
  389. } {1 {database disk image is malformed}}
  390. }
  391. corruption_test -sqlprep {
  392. CREATE TABLE t1(a, b, c); CREATE TABLE t8(a, b, c); CREATE TABLE tE(a, b, c);
  393. CREATE TABLE t2(a, b, c); CREATE TABLE t9(a, b, c); CREATE TABLE tF(a, b, c);
  394. CREATE TABLE t3(a, b, c); CREATE TABLE tA(a, b, c); CREATE TABLE tG(a, b, c);
  395. CREATE TABLE t4(a, b, c); CREATE TABLE tB(a, b, c); CREATE TABLE tH(a, b, c);
  396. CREATE TABLE t5(a, b, c); CREATE TABLE tC(a, b, c); CREATE TABLE tI(a, b, c);
  397. CREATE TABLE t6(a, b, c); CREATE TABLE tD(a, b, c); CREATE TABLE tJ(a, b, c);
  398. CREATE TABLE x1(a, b, c); CREATE TABLE x8(a, b, c); CREATE TABLE xE(a, b, c);
  399. CREATE TABLE x2(a, b, c); CREATE TABLE x9(a, b, c); CREATE TABLE xF(a, b, c);
  400. CREATE TABLE x3(a, b, c); CREATE TABLE xA(a, b, c); CREATE TABLE xG(a, b, c);
  401. CREATE TABLE x4(a, b, c); CREATE TABLE xB(a, b, c); CREATE TABLE xH(a, b, c);
  402. CREATE TABLE x5(a, b, c); CREATE TABLE xC(a, b, c); CREATE TABLE xI(a, b, c);
  403. CREATE TABLE x6(a, b, c); CREATE TABLE xD(a, b, c); CREATE TABLE xJ(a, b, c);
  404. } -corrupt {
  405. set fd [open corrupt.db r+]
  406. fconfigure $fd -translation binary -encoding binary
  407. seek $fd 108
  408. set zRightChild [read $fd 4]
  409. binary scan $zRightChild I iRightChild
  410. seek $fd [expr 1024*($iRightChild-1)+3]
  411. puts -nonewline $fd "\x00\x00"
  412. close $fd
  413. } -test {
  414. do_test corrupt2-9.1 {
  415. catchsql " $::presql SELECT sql FROM sqlite_master "
  416. } {1 {database disk image is malformed}}
  417. }
  418. corruption_test -sqlprep {
  419. CREATE TABLE t1(a, b, c);
  420. CREATE TABLE t2(a, b, c);
  421. PRAGMA writable_schema = 1;
  422. UPDATE sqlite_master SET rootpage = NULL WHERE name = 't2';
  423. } -test {
  424. do_test corrupt2-10.1 {
  425. catchsql " $::presql SELECT * FROM t2 "
  426. } {1 {malformed database schema (t2)}}
  427. do_test corrupt2-10.2 {
  428. sqlite3_errcode db
  429. } {SQLITE_CORRUPT}
  430. }
  431. corruption_test -sqlprep {
  432. PRAGMA auto_vacuum = incremental;
  433. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  434. CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
  435. INSERT INTO t1 VALUES(1, randstr(100,100));
  436. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  437. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  438. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  439. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  440. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  441. INSERT INTO t2 SELECT * FROM t1;
  442. DELETE FROM t1;
  443. } -corrupt {
  444. set offset [expr [file size corrupt.db] - 1024]
  445. hexio_write corrupt.db $offset FF
  446. hexio_write corrupt.db 24 12345678
  447. } -test {
  448. do_test corrupt2-11.1 {
  449. catchsql " $::presql PRAGMA incremental_vacuum "
  450. } {1 {database disk image is malformed}}
  451. }
  452. corruption_test -sqlprep {
  453. PRAGMA auto_vacuum = incremental;
  454. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  455. CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
  456. INSERT INTO t1 VALUES(1, randstr(100,100));
  457. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  458. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  459. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  460. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  461. INSERT INTO t1 SELECT NULL, randstr(100,100) FROM t1;
  462. INSERT INTO t2 SELECT * FROM t1;
  463. DELETE FROM t1;
  464. } -corrupt {
  465. set pgno [expr [file size corrupt.db] / 1024]
  466. hexio_write corrupt.db [expr 1024+5*($pgno-3)] 03
  467. hexio_write corrupt.db 24 12345678
  468. } -test {
  469. do_test corrupt2-12.1 {
  470. catchsql " $::presql PRAGMA incremental_vacuum "
  471. } {1 {database disk image is malformed}}
  472. }
  473. ifcapable autovacuum {
  474. # It is not possible for the last page in a database file to be the
  475. # pending-byte page (AKA the locking page). This test verifies that if
  476. # an attempt is made to commit a transaction to such an auto-vacuum
  477. # database SQLITE_CORRUPT is returned.
  478. #
  479. corruption_test -tclprep {
  480. db eval {
  481. PRAGMA auto_vacuum = full;
  482. PRAGMA page_size = 1024;
  483. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  484. INSERT INTO t1 VALUES(NULL, randstr(50,50));
  485. }
  486. for {set ii 0} {$ii < 10} {incr ii} {
  487. db eval " $::presql INSERT INTO t1 SELECT NULL, randstr(50,50) FROM t1 "
  488. }
  489. } -corrupt {
  490. do_test corrupt2-13.1 {
  491. file size corrupt.db
  492. } $::sqlite_pending_byte
  493. hexio_write corrupt.db [expr $::sqlite_pending_byte+1023] 00
  494. hexio_write corrupt.db 28 00000000
  495. } -test {
  496. do_test corrupt2-13.2 {
  497. file size corrupt.db
  498. } [expr $::sqlite_pending_byte + 1024]
  499. do_test corrupt2-13.3 {
  500. catchsql { DELETE FROM t1 WHERE rowid < 30; }
  501. } {1 {database disk image is malformed}}
  502. }
  503. }
  504. finish_test