mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Changes to make corruption errors easier to track down. (CVS 2709)
FossilOrigin-Name: c07330000b9427a77f412918078beffa18de2c36
This commit is contained in:
28
manifest
28
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Update\sthe\swebpage\sdescription\sof\s3.2.6\schanges\sto\stalk\sabout\sticket\s#1432.\s(CVS\s2708)
|
C Changes\sto\smake\scorruption\serrors\seasier\sto\strack\sdown.\s(CVS\s2709)
|
||||||
D 2005-09-17T15:17:40
|
D 2005-09-17T15:20:27
|
||||||
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
|
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
|
||||||
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
|
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@@ -32,7 +32,7 @@ F src/alter.c 26d755f2143719dd3f5b8aaf6cbe3c7f95332528
|
|||||||
F src/analyze.c 43a2d91242bdd71b6c299378f6b11e896ee5e43d
|
F src/analyze.c 43a2d91242bdd71b6c299378f6b11e896ee5e43d
|
||||||
F src/attach.c 4b21689700a72ae281fa85dbaff06b2a62bd49ee
|
F src/attach.c 4b21689700a72ae281fa85dbaff06b2a62bd49ee
|
||||||
F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454
|
F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454
|
||||||
F src/btree.c a83b30bf0a533d1d56476678bbb79c58d2132838
|
F src/btree.c 236126155d5607da945d33514218cbec762d887e
|
||||||
F src/btree.h 1ed561263ca0e335bc3e81d761c9d5ff8c22f61e
|
F src/btree.h 1ed561263ca0e335bc3e81d761c9d5ff8c22f61e
|
||||||
F src/build.c 74653e045581bfbadb8b35a0cb38a62f4a2c850e
|
F src/build.c 74653e045581bfbadb8b35a0cb38a62f4a2c850e
|
||||||
F src/callback.c 9a1162c8f9dae9fad6d548339669aacb5f6cf76b
|
F src/callback.c 9a1162c8f9dae9fad6d548339669aacb5f6cf76b
|
||||||
@@ -46,17 +46,17 @@ F src/hash.c 2b1b13f7400e179631c83a1be0c664608c8f021f
|
|||||||
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
||||||
F src/insert.c 484c73bc1309f283a31baa0e114f3ee980536397
|
F src/insert.c 484c73bc1309f283a31baa0e114f3ee980536397
|
||||||
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
||||||
F src/main.c bf88855445d365b497070d85e3faa0579a9edb91
|
F src/main.c 422014201f22aa17b96c76650163178a91a825af
|
||||||
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
||||||
F src/os.h 5a0a42555a750f334b7da973776803a0e3cc263a
|
F src/os.h c51f2747f7bd1840447e2c7d26db749604626814
|
||||||
F src/os_common.h fb2aa1b3ca31f7292e8b6e1c9420c2f825f0b1e5
|
F src/os_common.h 1ff88c7e7e6bd3e5f85443106c91cc26a4f8600b
|
||||||
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
|
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
|
||||||
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
||||||
F src/os_unix.c c86cf43b7ca9200e6fb7bc202ad2cc7da2f69367
|
F src/os_unix.c c86cf43b7ca9200e6fb7bc202ad2cc7da2f69367
|
||||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||||
F src/os_win.c ed03a35b2894f9b99840415f941a9f8594dea756
|
F src/os_win.c ed03a35b2894f9b99840415f941a9f8594dea756
|
||||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||||
F src/pager.c 68b059546919456925a90c5c30c451642f07893c
|
F src/pager.c adbb27f13ac75cd5bc29a3d84803e0cab1edfa88
|
||||||
F src/pager.h 17b13225abd93c1e9f470060f40a21b9edb5a164
|
F src/pager.h 17b13225abd93c1e9f470060f40a21b9edb5a164
|
||||||
F src/parse.y 5602d5cb894dda2932bf50b7e88782a4440ae3ae
|
F src/parse.y 5602d5cb894dda2932bf50b7e88782a4440ae3ae
|
||||||
F src/pragma.c 69413fbdc0c6aaa493a776ea52c1b3e6cf35dfb2
|
F src/pragma.c 69413fbdc0c6aaa493a776ea52c1b3e6cf35dfb2
|
||||||
@@ -66,7 +66,7 @@ F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
|
|||||||
F src/select.c 9ef1dddd436e1ea86a6bf64ae0ed71bf4a0b894f
|
F src/select.c 9ef1dddd436e1ea86a6bf64ae0ed71bf4a0b894f
|
||||||
F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3
|
F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3
|
||||||
F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2
|
F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2
|
||||||
F src/sqliteInt.h cc685a74a0458bc41a34131e7c0b217654558b6c
|
F src/sqliteInt.h cc5874662b2b3236e2d70a23429561b9f469c423
|
||||||
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
|
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
|
||||||
F src/tclsqlite.c ac94682f9e601dd373912c46414a5a842db2089a
|
F src/tclsqlite.c ac94682f9e601dd373912c46414a5a842db2089a
|
||||||
F src/test1.c b569b60e35f0e3ea20e5ebfaf6e522a01c08d481
|
F src/test1.c b569b60e35f0e3ea20e5ebfaf6e522a01c08d481
|
||||||
@@ -80,11 +80,11 @@ F src/update.c c2716c2115533ffae3d08bf8853aaba4f970f37e
|
|||||||
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
|
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
|
||||||
F src/util.c fa99c441e8ff52c75cde944ea73ea39f6d5a2a09
|
F src/util.c fa99c441e8ff52c75cde944ea73ea39f6d5a2a09
|
||||||
F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c
|
F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c
|
||||||
F src/vdbe.c 3cbb9bb5ab70c9587e39a219a2c007ad7bfc70b5
|
F src/vdbe.c de007d59f036fcd1b89a7d4172aa0d028e8689eb
|
||||||
F src/vdbe.h c8e105979fc7aaf5b8004e9621904e3bd096dfa2
|
F src/vdbe.h c8e105979fc7aaf5b8004e9621904e3bd096dfa2
|
||||||
F src/vdbeInt.h 3dd2a29c7b0a55404c35f93caae81fb42f4cb70a
|
F src/vdbeInt.h 3dd2a29c7b0a55404c35f93caae81fb42f4cb70a
|
||||||
F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd
|
F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd
|
||||||
F src/vdbeaux.c e3a815a88bbf68f17880f5bc077e1c35d14b9409
|
F src/vdbeaux.c b1db8b87935e7c864e6cdd9e39e07b6efdc2f576
|
||||||
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
||||||
F src/vdbemem.c fea0744936008831daa17cdc75056c3ca1469690
|
F src/vdbemem.c fea0744936008831daa17cdc75056c3ca1469690
|
||||||
F src/where.c 1cc55c9aa142c7ef09b427f5fd0bf0488e365fc4
|
F src/where.c 1cc55c9aa142c7ef09b427f5fd0bf0488e365fc4
|
||||||
@@ -213,7 +213,7 @@ F test/table.test ec0e6c2186bb8f6824f470caa118524dfd8fe057
|
|||||||
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
|
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
|
||||||
F test/tclsqlite.test 2da3e4b3a79b13c1511c9d0cd995e08f8362e782
|
F test/tclsqlite.test 2da3e4b3a79b13c1511c9d0cd995e08f8362e782
|
||||||
F test/temptable.test 7927261befdbc7b0a7ffebb85ecc70a74fa7b15b
|
F test/temptable.test 7927261befdbc7b0a7ffebb85ecc70a74fa7b15b
|
||||||
F test/tester.tcl 98ecdc5723b3b2be5a8a5c3a7f38fa53031466ee
|
F test/tester.tcl 1e75553d320f5d2720613d8483c934488fc2c56f
|
||||||
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
|
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
|
||||||
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
|
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
|
||||||
F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b
|
F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b
|
||||||
@@ -309,7 +309,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
||||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||||
P 553b7ba8f8ae4cb865494f2d301690149d7edb9f
|
P 0e23c28b25aced292cb068bc9a202cb627ba38ec
|
||||||
R 8d1e61fc6f8991d406d873110f916835
|
R d840a4aee99798668c3447332ee407db
|
||||||
U drh
|
U drh
|
||||||
Z 7704cf86f431264a6d16e778f11a63db
|
Z 45298cf04a67874db88d26d3bf9dc754
|
||||||
|
@@ -1 +1 @@
|
|||||||
0e23c28b25aced292cb068bc9a202cb627ba38ec
|
c07330000b9427a77f412918078beffa18de2c36
|
47
src/btree.c
47
src/btree.c
@@ -9,7 +9,7 @@
|
|||||||
** May you share freely, never taking more than you give.
|
** May you share freely, never taking more than you give.
|
||||||
**
|
**
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
** $Id: btree.c,v 1.268 2005/09/16 11:32:18 drh Exp $
|
** $Id: btree.c,v 1.269 2005/09/17 15:20:27 drh Exp $
|
||||||
**
|
**
|
||||||
** This file implements a external (disk-based) database using BTrees.
|
** This file implements a external (disk-based) database using BTrees.
|
||||||
** For a detailed discussion of BTrees, refer to
|
** For a detailed discussion of BTrees, refer to
|
||||||
@@ -494,7 +494,7 @@ static int ptrmapPut(Btree *pBt, Pgno key, u8 eType, Pgno parent){
|
|||||||
|
|
||||||
assert( pBt->autoVacuum );
|
assert( pBt->autoVacuum );
|
||||||
if( key==0 ){
|
if( key==0 ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
iPtrmap = PTRMAP_PAGENO(pBt->usableSize, key);
|
iPtrmap = PTRMAP_PAGENO(pBt->usableSize, key);
|
||||||
rc = sqlite3pager_get(pBt->pPager, iPtrmap, (void **)&pPtrmap);
|
rc = sqlite3pager_get(pBt->pPager, iPtrmap, (void **)&pPtrmap);
|
||||||
@@ -540,7 +540,7 @@ static int ptrmapGet(Btree *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
|
|||||||
if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
|
if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
|
||||||
|
|
||||||
sqlite3pager_unref(pPtrmap);
|
sqlite3pager_unref(pPtrmap);
|
||||||
if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT;
|
if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1030,7 +1030,7 @@ static int initPage(
|
|||||||
assert( pPage->aData == &((unsigned char*)pPage)[-pBt->pageSize] );
|
assert( pPage->aData == &((unsigned char*)pPage)[-pBt->pageSize] );
|
||||||
if( pPage->pParent!=pParent && (pPage->pParent!=0 || pPage->isInit) ){
|
if( pPage->pParent!=pParent && (pPage->pParent!=0 || pPage->isInit) ){
|
||||||
/* The parent page should never change unless the file is corrupt */
|
/* The parent page should never change unless the file is corrupt */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
if( pPage->isInit ) return SQLITE_OK;
|
if( pPage->isInit ) return SQLITE_OK;
|
||||||
if( pPage->pParent==0 && pParent!=0 ){
|
if( pPage->pParent==0 && pParent!=0 ){
|
||||||
@@ -1048,11 +1048,11 @@ static int initPage(
|
|||||||
pPage->nCell = get2byte(&data[hdr+3]);
|
pPage->nCell = get2byte(&data[hdr+3]);
|
||||||
if( pPage->nCell>MX_CELL(pBt) ){
|
if( pPage->nCell>MX_CELL(pBt) ){
|
||||||
/* To many cells for a single page. The page must be corrupt */
|
/* To many cells for a single page. The page must be corrupt */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
if( pPage->nCell==0 && pParent!=0 && pParent->pgno!=1 ){
|
if( pPage->nCell==0 && pParent!=0 && pParent->pgno!=1 ){
|
||||||
/* All pages must have at least one cell, except for root pages */
|
/* All pages must have at least one cell, except for root pages */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the total free space on the page */
|
/* Compute the total free space on the page */
|
||||||
@@ -1062,13 +1062,13 @@ static int initPage(
|
|||||||
int next, size;
|
int next, size;
|
||||||
if( pc>usableSize-4 ){
|
if( pc>usableSize-4 ){
|
||||||
/* Free block is off the page */
|
/* Free block is off the page */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
next = get2byte(&data[pc]);
|
next = get2byte(&data[pc]);
|
||||||
size = get2byte(&data[pc+2]);
|
size = get2byte(&data[pc+2]);
|
||||||
if( next>0 && next<=pc+size+3 ){
|
if( next>0 && next<=pc+size+3 ){
|
||||||
/* Free blocks must be in accending order */
|
/* Free blocks must be in accending order */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
nFree += size;
|
nFree += size;
|
||||||
pc = next;
|
pc = next;
|
||||||
@@ -1076,7 +1076,7 @@ static int initPage(
|
|||||||
pPage->nFree = nFree;
|
pPage->nFree = nFree;
|
||||||
if( nFree>=usableSize ){
|
if( nFree>=usableSize ){
|
||||||
/* Free space cannot exceed total page size */
|
/* Free space cannot exceed total page size */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPage->isInit = 1;
|
pPage->isInit = 1;
|
||||||
@@ -1146,7 +1146,7 @@ static int getAndInitPage(
|
|||||||
){
|
){
|
||||||
int rc;
|
int rc;
|
||||||
if( pgno==0 ){
|
if( pgno==0 ){
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
rc = getPage(pBt, pgno, ppPage);
|
rc = getPage(pBt, pgno, ppPage);
|
||||||
if( rc==SQLITE_OK && (*ppPage)->isInit==0 ){
|
if( rc==SQLITE_OK && (*ppPage)->isInit==0 ){
|
||||||
@@ -1714,7 +1714,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
|
|||||||
if( eType==PTRMAP_OVERFLOW2 ){
|
if( eType==PTRMAP_OVERFLOW2 ){
|
||||||
/* The pointer is always the first 4 bytes of the page in this case. */
|
/* The pointer is always the first 4 bytes of the page in this case. */
|
||||||
if( get4byte(pPage->aData)!=iFrom ){
|
if( get4byte(pPage->aData)!=iFrom ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
put4byte(pPage->aData, iTo);
|
put4byte(pPage->aData, iTo);
|
||||||
}else{
|
}else{
|
||||||
@@ -1747,7 +1747,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
|
|||||||
if( i==nCell ){
|
if( i==nCell ){
|
||||||
if( eType!=PTRMAP_BTREE ||
|
if( eType!=PTRMAP_BTREE ||
|
||||||
get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
|
get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
|
put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
|
||||||
}
|
}
|
||||||
@@ -1860,7 +1860,7 @@ static int autoVacuumCommit(Btree *pBt, Pgno *nTrunc){
|
|||||||
|
|
||||||
assert( pBt->autoVacuum );
|
assert( pBt->autoVacuum );
|
||||||
if( PTRMAP_ISPAGE(pgsz, sqlite3pager_pagecount(pPager)) ){
|
if( PTRMAP_ISPAGE(pgsz, sqlite3pager_pagecount(pPager)) ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out how many free-pages are in the database. If there are no
|
/* Figure out how many free-pages are in the database. If there are no
|
||||||
@@ -1898,7 +1898,7 @@ static int autoVacuumCommit(Btree *pBt, Pgno *nTrunc){
|
|||||||
rc = ptrmapGet(pBt, iDbPage, &eType, &iPtrPage);
|
rc = ptrmapGet(pBt, iDbPage, &eType, &iPtrPage);
|
||||||
if( rc!=SQLITE_OK ) goto autovacuum_out;
|
if( rc!=SQLITE_OK ) goto autovacuum_out;
|
||||||
if( eType==PTRMAP_ROOTPAGE ){
|
if( eType==PTRMAP_ROOTPAGE ){
|
||||||
rc = SQLITE_CORRUPT;
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
goto autovacuum_out;
|
goto autovacuum_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2414,7 +2414,7 @@ static int getPayload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( amt>0 ){
|
if( amt>0 ){
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
@@ -2432,7 +2432,7 @@ int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
|
|||||||
assert( pCur->isValid );
|
assert( pCur->isValid );
|
||||||
assert( pCur->pPage!=0 );
|
assert( pCur->pPage!=0 );
|
||||||
if( pCur->pPage->intKey ){
|
if( pCur->pPage->intKey ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
assert( pCur->pPage->intKey==0 );
|
assert( pCur->pPage->intKey==0 );
|
||||||
assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
|
assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
|
||||||
@@ -2552,7 +2552,7 @@ static int moveToChild(BtCursor *pCur, u32 newPgno){
|
|||||||
pCur->idx = 0;
|
pCur->idx = 0;
|
||||||
pCur->info.nSize = 0;
|
pCur->info.nSize = 0;
|
||||||
if( pNewPage->nCell<1 ){
|
if( pNewPage->nCell<1 ){
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
@@ -2761,7 +2761,7 @@ int sqlite3BtreeMoveto(BtCursor *pCur, const void *pKey, i64 nKey, int *pRes){
|
|||||||
lwr = 0;
|
lwr = 0;
|
||||||
upr = pPage->nCell-1;
|
upr = pPage->nCell-1;
|
||||||
if( !pPage->intKey && pKey==0 ){
|
if( !pPage->intKey && pKey==0 ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
pageIntegrity(pPage);
|
pageIntegrity(pPage);
|
||||||
while( lwr<=upr ){
|
while( lwr<=upr ){
|
||||||
@@ -3046,7 +3046,7 @@ static int allocatePage(
|
|||||||
TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
|
TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
|
||||||
}else if( k>pBt->usableSize/4 - 8 ){
|
}else if( k>pBt->usableSize/4 - 8 ){
|
||||||
/* Value of k is out of range. Database corruption */
|
/* Value of k is out of range. Database corruption */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||||
}else if( searchList && nearby==iTrunk ){
|
}else if( searchList && nearby==iTrunk ){
|
||||||
/* The list is being searched and this trunk page is the page
|
/* The list is being searched and this trunk page is the page
|
||||||
@@ -3121,7 +3121,7 @@ static int allocatePage(
|
|||||||
*pPgno = iPage;
|
*pPgno = iPage;
|
||||||
if( *pPgno>sqlite3pager_pagecount(pBt->pPager) ){
|
if( *pPgno>sqlite3pager_pagecount(pBt->pPager) ){
|
||||||
/* Free page off the end of the file */
|
/* Free page off the end of the file */
|
||||||
return SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
|
TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
|
||||||
": %d more free pages\n",
|
": %d more free pages\n",
|
||||||
@@ -3262,7 +3262,7 @@ static int clearCell(MemPage *pPage, unsigned char *pCell){
|
|||||||
while( ovflPgno!=0 ){
|
while( ovflPgno!=0 ){
|
||||||
MemPage *pOvfl;
|
MemPage *pOvfl;
|
||||||
if( ovflPgno>sqlite3pager_pagecount(pBt->pPager) ){
|
if( ovflPgno>sqlite3pager_pagecount(pBt->pPager) ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
rc = getPage(pBt, ovflPgno, &pOvfl);
|
rc = getPage(pBt, ovflPgno, &pOvfl);
|
||||||
if( rc ) return rc;
|
if( rc ) return rc;
|
||||||
@@ -4668,7 +4668,7 @@ int sqlite3BtreeDelete(BtCursor *pCur){
|
|||||||
rc = sqlite3BtreeNext(&leafCur, ¬Used);
|
rc = sqlite3BtreeNext(&leafCur, ¬Used);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
if( rc!=SQLITE_NOMEM ){
|
if( rc!=SQLITE_NOMEM ){
|
||||||
rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
@@ -4854,7 +4854,7 @@ static int clearDatabasePage(
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( pgno>sqlite3pager_pagecount(pBt->pPager) ){
|
if( pgno>sqlite3pager_pagecount(pBt->pPager) ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = getAndInitPage(pBt, pgno, &pPage, pParent);
|
rc = getAndInitPage(pBt, pgno, &pPage, pParent);
|
||||||
@@ -5759,6 +5759,7 @@ int sqlite3BtreeCopyFile(Btree *pBtTo, Btree *pBtFrom){
|
|||||||
}
|
}
|
||||||
for(i=nPage+1; rc==SQLITE_OK && i<=nToPage; i++){
|
for(i=nPage+1; rc==SQLITE_OK && i<=nToPage; i++){
|
||||||
void *pPage;
|
void *pPage;
|
||||||
|
if( i==iSkip ) continue;
|
||||||
rc = sqlite3pager_get(pBtTo->pPager, i, &pPage);
|
rc = sqlite3pager_get(pBtTo->pPager, i, &pPage);
|
||||||
if( rc ) break;
|
if( rc ) break;
|
||||||
rc = sqlite3pager_write(pPage);
|
rc = sqlite3pager_write(pPage);
|
||||||
|
13
src/main.c
13
src/main.c
@@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.301 2005/09/07 21:22:46 drh Exp $
|
** $Id: main.c,v 1.302 2005/09/17 15:20:27 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@@ -1047,3 +1047,14 @@ recover_out:
|
|||||||
int sqlite3_get_autocommit(sqlite3 *db){
|
int sqlite3_get_autocommit(sqlite3 *db){
|
||||||
return db->autoCommit;
|
return db->autoCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SQLITE_DEBUG
|
||||||
|
/*
|
||||||
|
** The following routine is subtituted for constant SQLITE_CORRUPT in
|
||||||
|
** debugging builds. This provides a way to set a breakpoint for when
|
||||||
|
** corruption is first detected.
|
||||||
|
*/
|
||||||
|
int sqlite3Corrupt(void){
|
||||||
|
return SQLITE_CORRUPT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
1
src/os.h
1
src/os.h
@@ -164,7 +164,6 @@
|
|||||||
#ifndef SQLITE_TEST
|
#ifndef SQLITE_TEST
|
||||||
#define PENDING_BYTE 0x40000000 /* First byte past the 1GB boundary */
|
#define PENDING_BYTE 0x40000000 /* First byte past the 1GB boundary */
|
||||||
#else
|
#else
|
||||||
/* Defined in test2.c (pager tests) */
|
|
||||||
extern unsigned int sqlite3_pending_byte;
|
extern unsigned int sqlite3_pending_byte;
|
||||||
#define PENDING_BYTE sqlite3_pending_byte
|
#define PENDING_BYTE sqlite3_pending_byte
|
||||||
#endif
|
#endif
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
* pending-byte in the database file.
|
* pending-byte in the database file.
|
||||||
*/
|
*/
|
||||||
#ifdef SQLITE_TEST
|
#ifdef SQLITE_TEST
|
||||||
unsigned int sqlite3_pending_byte = 0x0010000;
|
unsigned int sqlite3_pending_byte = 0x40000000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int sqlite3_os_trace = 0;
|
int sqlite3_os_trace = 0;
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
** file simultaneously, or one process from reading the database while
|
** file simultaneously, or one process from reading the database while
|
||||||
** another is writing.
|
** another is writing.
|
||||||
**
|
**
|
||||||
** @(#) $Id: pager.c,v 1.214 2005/09/16 17:16:53 drh Exp $
|
** @(#) $Id: pager.c,v 1.215 2005/09/17 15:20:27 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_DISKIO
|
#ifndef SQLITE_OMIT_DISKIO
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -1491,7 +1491,7 @@ static int pager_stmt_playback(Pager *pPager){
|
|||||||
end_stmt_playback:
|
end_stmt_playback:
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
pPager->errMask |= PAGER_ERR_CORRUPT;
|
pPager->errMask |= PAGER_ERR_CORRUPT;
|
||||||
rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
rc = SQLITE_CORRUPT;
|
||||||
}else{
|
}else{
|
||||||
pPager->journalOff = szJ;
|
pPager->journalOff = szJ;
|
||||||
/* pager_reload_cache(pPager); */
|
/* pager_reload_cache(pPager); */
|
||||||
@@ -2308,7 +2308,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
|
|||||||
** number greater than this, or zero, is requested.
|
** number greater than this, or zero, is requested.
|
||||||
*/
|
*/
|
||||||
if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
|
if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we have not hit any critical errors.
|
/* Make sure we have not hit any critical errors.
|
||||||
@@ -3193,7 +3193,7 @@ int sqlite3pager_rollback(Pager *pPager){
|
|||||||
rc = pager_playback(pPager);
|
rc = pager_playback(pPager);
|
||||||
}
|
}
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
pPager->errMask |= PAGER_ERR_CORRUPT;
|
pPager->errMask |= PAGER_ERR_CORRUPT;
|
||||||
}
|
}
|
||||||
pPager->dbSize = -1;
|
pPager->dbSize = -1;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.418 2005/09/16 02:38:11 drh Exp $
|
** @(#) $Id: sqliteInt.h,v 1.419 2005/09/17 15:20:27 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITEINT_H_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
@@ -1373,6 +1373,19 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
extern int sqlite3_always_code_trigger_setup;
|
extern int sqlite3_always_code_trigger_setup;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The SQLITE_CORRUPT_BKPT macro can be either a constant (for production
|
||||||
|
** builds) or a function call (for debugging). If it is a function call,
|
||||||
|
** it allows the operator to set a breakpoint at the spot where database
|
||||||
|
** corruption is first detected.
|
||||||
|
*/
|
||||||
|
#ifdef SQLITE_DEBUG
|
||||||
|
extern int sqlite3Corrupt(void);
|
||||||
|
# define SQLITE_CORRUPT_BKPT sqlite3Corrupt()
|
||||||
|
#else
|
||||||
|
# define SQLITE_CORRUPT_BKPT SQLITE_CORRUPT
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Internal function prototypes
|
** Internal function prototypes
|
||||||
*/
|
*/
|
||||||
|
10
src/vdbe.c
10
src/vdbe.c
@@ -43,7 +43,7 @@
|
|||||||
** in this file for details. If in doubt, do not deviate from existing
|
** in this file for details. If in doubt, do not deviate from existing
|
||||||
** commenting and indentation practices when changing or adding code.
|
** commenting and indentation practices when changing or adding code.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.c,v 1.487 2005/09/16 02:38:11 drh Exp $
|
** $Id: vdbe.c,v 1.488 2005/09/17 15:20:28 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@@ -1962,7 +1962,7 @@ case OP_Column: {
|
|||||||
** we are dealing with a malformed record.
|
** we are dealing with a malformed record.
|
||||||
*/
|
*/
|
||||||
if( idx!=szHdr || offset!=payloadSize ){
|
if( idx!=szHdr || offset!=payloadSize ){
|
||||||
rc = SQLITE_CORRUPT;
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
goto op_column_out;
|
goto op_column_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2516,7 +2516,7 @@ case OP_OpenWrite: { /* no-push */
|
|||||||
** only mean that we are dealing with a corrupt database file
|
** only mean that we are dealing with a corrupt database file
|
||||||
*/
|
*/
|
||||||
if( (flags & 0xf0)!=0 || ((flags & 0x07)!=5 && (flags & 0x07)!=2) ){
|
if( (flags & 0xf0)!=0 || ((flags & 0x07)!=5 && (flags & 0x07)!=2) ){
|
||||||
rc = SQLITE_CORRUPT;
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
goto abort_due_to_error;
|
goto abort_due_to_error;
|
||||||
}
|
}
|
||||||
pCur->isTable = (flags & BTREE_INTKEY)!=0;
|
pCur->isTable = (flags & BTREE_INTKEY)!=0;
|
||||||
@@ -2527,7 +2527,7 @@ case OP_OpenWrite: { /* no-push */
|
|||||||
*/
|
*/
|
||||||
if( (pCur->isTable && pOp->p3type==P3_KEYINFO)
|
if( (pCur->isTable && pOp->p3type==P3_KEYINFO)
|
||||||
|| (pCur->isIndex && pOp->p3type!=P3_KEYINFO) ){
|
|| (pCur->isIndex && pOp->p3type!=P3_KEYINFO) ){
|
||||||
rc = SQLITE_CORRUPT;
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
goto abort_due_to_error;
|
goto abort_due_to_error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3056,7 +3056,7 @@ case OP_NewRowid: {
|
|||||||
cnt = 0;
|
cnt = 0;
|
||||||
if( (sqlite3BtreeFlags(pC->pCursor)&(BTREE_INTKEY|BTREE_ZERODATA)) !=
|
if( (sqlite3BtreeFlags(pC->pCursor)&(BTREE_INTKEY|BTREE_ZERODATA)) !=
|
||||||
BTREE_INTKEY ){
|
BTREE_INTKEY ){
|
||||||
rc = SQLITE_CORRUPT;
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
goto abort_due_to_error;
|
goto abort_due_to_error;
|
||||||
}
|
}
|
||||||
assert( (sqlite3BtreeFlags(pC->pCursor) & BTREE_INTKEY)!=0 );
|
assert( (sqlite3BtreeFlags(pC->pCursor) & BTREE_INTKEY)!=0 );
|
||||||
|
@@ -1712,7 +1712,7 @@ int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
|
|||||||
|
|
||||||
sqlite3BtreeKeySize(pCur, &nCellKey);
|
sqlite3BtreeKeySize(pCur, &nCellKey);
|
||||||
if( nCellKey<=0 ){
|
if( nCellKey<=0 ){
|
||||||
return SQLITE_CORRUPT;
|
return SQLITE_CORRUPT_BKPT;
|
||||||
}
|
}
|
||||||
rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
|
rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
|
||||||
if( rc ){
|
if( rc ){
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
# This file implements some common TCL routines used for regression
|
# This file implements some common TCL routines used for regression
|
||||||
# testing the SQLite library
|
# testing the SQLite library
|
||||||
#
|
#
|
||||||
# $Id: tester.tcl,v 1.49 2005/05/26 15:20:53 danielk1977 Exp $
|
# $Id: tester.tcl,v 1.50 2005/09/17 15:20:28 drh Exp $
|
||||||
|
|
||||||
# Make sure tclsqlite3 was compiled correctly. Abort now with an
|
# Make sure tclsqlite3 was compiled correctly. Abort now with an
|
||||||
# error message if not.
|
# error message if not.
|
||||||
@@ -41,6 +41,7 @@ if {[sqlite3 -tcl-uses-utf]} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set tcl_precision 15
|
set tcl_precision 15
|
||||||
|
set sqlite_pending_byte 0x0010000
|
||||||
|
|
||||||
# Use the pager codec if it is available
|
# Use the pager codec if it is available
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user