Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Ensure that "PRAGMA integrity_check" reports an error if the free-list count header field contains a value smaller than the actual number of pages on the database free-list. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
26f64986d1ed59c554a7cb9e00e86a7f |
User & Date: | dan 2015-09-18 14:45:01.549 |
Context
2015-09-18
| ||
15:13 | Fix sqlilimits.test module so that it knows that the SELECT in a CREATE VIEW is not checked until the view is actually used. (check-in: acf5d87f94 user: drh tags: trunk) | |
14:45 | Ensure that "PRAGMA integrity_check" reports an error if the free-list count header field contains a value smaller than the actual number of pages on the database free-list. (check-in: 26f64986d1 user: dan tags: trunk) | |
14:42 | Fix the orderby9.test case so that it works with 32-bit versions of TCL (check-in: 4b6af77430 user: drh tags: trunk) | |
Changes
Changes to src/btree.c.
︙ | ︙ | |||
8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 | i = get4byte(pOvflData); checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage); } } #endif iPage = get4byte(pOvflData); sqlite3PagerUnref(pOvflPage); } } #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ /* ** An implementation of a min-heap. ** | > > > > | 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 | i = get4byte(pOvflData); checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage); } } #endif iPage = get4byte(pOvflData); sqlite3PagerUnref(pOvflPage); if( isFreeList && N<(iPage!=0) ){ checkAppendMsg(pCheck, "free-page count in header is too small"); } } } #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ /* ** An implementation of a min-heap. ** |
︙ | ︙ |
Changes to test/corrupt2.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # # $Id: corrupt2.test,v 1.20 2009/04/06 17:50:03 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Do not use a codec for tests in this file, as the database file is # manipulated directly using tcl scripts (using the [hexio_write] command). # do_not_use_codec # These tests deal with corrupt database files | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # # $Id: corrupt2.test,v 1.20 2009/04/06 17:50:03 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix corrupt2 # Do not use a codec for tests in this file, as the database file is # manipulated directly using tcl scripts (using the [hexio_write] command). # do_not_use_codec # These tests deal with corrupt database files |
︙ | ︙ | |||
553 554 555 556 557 558 559 560 561 | file size corrupt.db } [expr $::sqlite_pending_byte + 1024] do_test corrupt2-13.3 { catchsql { DELETE FROM t1 WHERE rowid < 30; } } {1 {database disk image is malformed}} } } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | file size corrupt.db } [expr $::sqlite_pending_byte + 1024] do_test corrupt2-13.3 { catchsql { DELETE FROM t1 WHERE rowid < 30; } } {1 {database disk image is malformed}} } } #------------------------------------------------------------------------- # Test that PRAGMA integrity_check detects cases where the freelist-count # header field is smaller than the actual number of pages on the freelist. # reset_db do_execsql_test 14.0 { PRAGMA auto_vacuum = 0; CREATE TABLE t1(x); INSERT INTO t1 VALUES(randomblob(3500)); DELETE FROM t1; } do_execsql_test 14.1 { PRAGMA integrity_check; PRAGMA freelist_count; } {ok 3} # There are now 3 free pages. Modify the header-field so that it # (incorrectly) says that just 2 are free. do_test 14.2 { db close hexio_write test.db 36 [hexio_render_int32 2] sqlite3 db test.db execsql { PRAGMA freelist_count } } {2} do_execsql_test 14.3 { PRAGMA integrity_check; } {{*** in database main *** Main freelist: free-page count in header is too small}} # Use 2 of the free pages on the free-list. # do_execsql_test 14.4 { INSERT INTO t1 VALUES(randomblob(2500)); PRAGMA freelist_count; } {0} do_execsql_test 14.5 { PRAGMA integrity_check; } {{*** in database main *** Page 3 is never used}} finish_test finish_test |