Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix an assert that can fail if the database file is corrupted. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3f45b8192dad7fb1f027cbaa694046e3 |
User & Date: | dan 2014-08-14 19:53:37.748 |
Context
2014-08-15
| ||
11:46 | Version 3.8.6 (check-in: 9491ba7d73 user: drh tags: trunk, release, version-3.8.6) | |
2014-08-14
| ||
19:53 | Fix an assert that can fail if the database file is corrupted. (check-in: 3f45b8192d user: dan tags: trunk) | |
13:06 | Fix typos in comments used to help generate documentation. No changes to code. (check-in: 13a2d90a28 user: drh tags: trunk) | |
Changes
Changes to src/btree.c.
︙ | ︙ | |||
5737 5738 5739 5740 5741 5742 5743 | int cellOffset; /* Address of first cell pointer in data[] */ u8 *data; /* The content of the whole page */ int nSkip = (iChild ? 4 : 0); if( *pRC ) return; assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); | > | | 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 | int cellOffset; /* Address of first cell pointer in data[] */ u8 *data; /* The content of the whole page */ int nSkip = (iChild ? 4 : 0); if( *pRC ) return; assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); assert( MX_CELL(pPage->pBt)<=10921 ); assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB ); assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) ); assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) ); assert( sqlite3_mutex_held(pPage->pBt->mutex) ); /* The cell should normally be sized correctly. However, when moving a ** malformed cell from a leaf page to an interior page, if the cell size ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size ** might be less than 8 (leaf-size + pointer) on the interior node. Hence |
︙ | ︙ |
Changes to test/corruptI.test.
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 | catchsql { SELECT * FROM r WHERE x >= 10.0 } } {1 {database disk image is malformed}} do_test 2.2 { catchsql { SELECT * FROM r WHERE x >= 10 } } {1 {database disk image is malformed}} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | catchsql { SELECT * FROM r WHERE x >= 10.0 } } {1 {database disk image is malformed}} do_test 2.2 { catchsql { SELECT * FROM r WHERE x >= 10 } } {1 {database disk image is malformed}} reset_db do_execsql_test 3.1 { PRAGMA page_size = 512; CREATE TABLE t1(a INTEGER PRIMARY KEY, b); WITH s(a, b) AS ( SELECT 2, 'abcdefghij' UNION ALL SELECT a+2, b FROM s WHERe a < 40 ) INSERT INTO t1 SELECT * FROM s; } {} do_test 3.2 { hexio_write test.db [expr 512+3] 0054 db close sqlite3 db test.db execsql { INSERT INTO t1 VALUES(5, 'klmnopqrst') } execsql { INSERT INTO t1 VALUES(7, 'klmnopqrst') } } {} db close sqlite3 db test.db do_catchsql_test 3.2 { INSERT INTO t1 VALUES(9, 'klmnopqrst'); } {1 {database disk image is malformed}} finish_test |