SQLite

Check-in [dad2b74ad0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a problem in test script corrupt.test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dad2b74ad0a86ff07c77f0a60b26480fc0a2e54d
User & Date: dan 2009-09-10 18:04:02.000
Context
2009-09-10
18:17
Define SQLITE_TEST when compiling mem5.c for testfixture. (check-in: 6b16f3c907 user: dan tags: trunk)
18:04
Fix a problem in test script corrupt.test. (check-in: dad2b74ad0 user: dan tags: trunk)
17:45
Add assert() statement to verify that new mutexes are not allocated when the mutex subsystem is uninitialized. (check-in: 1183c53357 user: drh tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to test/corrupt.test.
222
223
224
225
226
227
228



229
230
231
232
233
234
235
do_test corrupt-5.2 {
  db close
  hexio_write test.db 108 00000000 
  sqlite3 db test.db
  catchsql { SELECT * FROM sqlite_master }
} {1 {database disk image is malformed}}




do_test corrupt-6.1 {
  db close
  file delete -force test.db test.db-journal
  sqlite3 db test.db
  execsql { 
    PRAGMA page_size = 1024; CREATE TABLE t1(x);
  }







>
>
>







222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
do_test corrupt-5.2 {
  db close
  hexio_write test.db 108 00000000 
  sqlite3 db test.db
  catchsql { SELECT * FROM sqlite_master }
} {1 {database disk image is malformed}}

# At one point, the specific corruption caused by this test case was
# causing a buffer overwrite. Although a crash was never demonstrated,
# running this testcase under valgrind revealed the problem.
do_test corrupt-6.1 {
  db close
  file delete -force test.db test.db-journal
  sqlite3 db test.db
  execsql { 
    PRAGMA page_size = 1024; CREATE TABLE t1(x);
  }
248
249
250
251
252
253
254
255
256
257
  db close

  set offset [expr ($rootpage * 1024)-14+2]
  hexio_write test.db $offset 00FF
  sqlite3 db test.db 

  catchsql { INSERT INTO t1 VALUES( randomblob(10) ) }
} {}

finish_test







|


251
252
253
254
255
256
257
258
259
260
  db close

  set offset [expr ($rootpage * 1024)-14+2]
  hexio_write test.db $offset 00FF
  sqlite3 db test.db 

  catchsql { INSERT INTO t1 VALUES( randomblob(10) ) }
} {1 {database disk image is malformed}}

finish_test