aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-07-30 18:40:55 +0000
committerdrh <drh@noemail.net>2010-07-30 18:40:55 +0000
commitbe0b237e6a547544d9bb34382b231b385278acfb (patch)
tree8a5c1a197384bdf80994febccdb3904e45366b3a /src
parenta3388cc5b0f7c3760083839750625fd4d6dee49f (diff)
downloadsqlite-be0b237e6a547544d9bb34382b231b385278acfb.tar.gz
sqlite-be0b237e6a547544d9bb34382b231b385278acfb.zip
If a database becomes corrupted such that an index is out of sync with its
table, make sure the corruption is detected and reported back. Do not assume that indices always contain rowids for valid table rows. FossilOrigin-Name: 83395a3d24f18170fc068d9e644291678694c3f0
Diffstat (limited to 'src')
-rw-r--r--src/vdbeaux.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 295a8c3a8..7729a85d4 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -2400,11 +2400,8 @@ int sqlite3VdbeCursorMoveto(VdbeCursor *p){
rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res);
if( rc ) return rc;
p->lastRowid = p->movetoTarget;
- p->rowidIsValid = ALWAYS(res==0) ?1:0;
- if( NEVER(res<0) ){
- rc = sqlite3BtreeNext(p->pCursor, &res);
- if( rc ) return rc;
- }
+ if( res!=0 ) return SQLITE_CORRUPT_BKPT;
+ p->rowidIsValid = 1;
#ifdef SQLITE_TEST
sqlite3_search_count++;
#endif