Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix two faulty assert() statements btree. (It was possible for the assertions to be false given a corrupt database file as input.) (CVS 6872) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9403f04dfdabdd2ba9adb1a91ca9b400 |
User & Date: | drh 2009-07-09 13:25:32.000 |
Context
2009-07-10
| ||
02:52 | Simplifications to the PRAGMA integrity_check logic in btree.c. (CVS 6873) (check-in: 440c573c7e user: drh tags: trunk) | |
2009-07-09
| ||
13:25 | Fix two faulty assert() statements btree. (It was possible for the assertions to be false given a corrupt database file as input.) (CVS 6872) (check-in: 9403f04dfd user: drh tags: trunk) | |
11:36 | Remove an unused branch from btree.c. (CVS 6871) (check-in: 45efb78a8a user: danielk1977 tags: trunk) | |
Changes
Changes to src/btree.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** $Id: btree.c,v 1.672 2009/07/09 13:25:32 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ #include "btreeInt.h" |
︙ | ︙ | |||
1071 1072 1073 1074 1075 1076 1077 | return SQLITE_CORRUPT_BKPT; } #else if( cbrk<iCellFirst || pc+size>usableSize ){ return SQLITE_CORRUPT_BKPT; } #endif | | | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | return SQLITE_CORRUPT_BKPT; } #else if( cbrk<iCellFirst || pc+size>usableSize ){ return SQLITE_CORRUPT_BKPT; } #endif assert( cbrk+size<=usableSize && cbrk>=iCellFirst ); testcase( cbrk+size==usableSize ); testcase( pc+size==usableSize ); memcpy(&data[cbrk], &temp[pc], size); put2byte(pAddr, cbrk); } assert( cbrk>=iCellFirst ); put2byte(&data[hdr+5], cbrk); |
︙ | ︙ | |||
1122 1123 1124 1125 1126 1127 1128 | assert( pPage->nFree>=nByte ); assert( pPage->nOverflow==0 ); nFrag = data[hdr+7]; assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf ); gap = pPage->cellOffset + 2*pPage->nCell; top = get2byte(&data[hdr+5]); | | | 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | assert( pPage->nFree>=nByte ); assert( pPage->nOverflow==0 ); nFrag = data[hdr+7]; assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf ); gap = pPage->cellOffset + 2*pPage->nCell; top = get2byte(&data[hdr+5]); if( gap>top ) return SQLITE_CORRUPT_BKPT; testcase( gap+2==top ); testcase( gap+1==top ); testcase( gap==top ); if( nFrag>=60 ){ /* Always defragment highly fragmented pages */ rc = defragmentPage(pPage); |
︙ | ︙ |