Index: src/vdbe.c ================================================================== --- src/vdbe.c +++ src/vdbe.c @@ -41,11 +41,11 @@ ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.446 2005/01/24 10:25:59 danielk1977 Exp $ +** $Id: vdbe.c,v 1.447 2005/01/26 21:55:32 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include #include "vdbeInt.h" @@ -1736,11 +1736,12 @@ assert( pCnt->flags & MEM_Int ); nField = pCnt->i; pCrsr = 0; }else if( (pC = p->apCsr[p1])->pCursor!=0 ){ /* The record is stored in a B-Tree */ - sqlite3VdbeCursorMoveto(pC); + rc = sqlite3VdbeCursorMoveto(pC); + if ( rc ) return rc; zRec = 0; pCrsr = pC->pCursor; if( pC->nullRow ){ payloadSize = 0; }else if( pC->cacheValid ){ @@ -3081,11 +3082,12 @@ Cursor *pC; assert( i>=0 && inCursor ); pC = p->apCsr[i]; assert( pC!=0 ); if( pC->pCursor!=0 ){ - sqlite3VdbeCursorMoveto(pC); + rc = sqlite3VdbeCursorMoveto(pC); + if ( rc ) return rc; rc = sqlite3BtreeDelete(pC->pCursor); pC->nextRowidValid = 0; pC->cacheValid = 0; } if( pOp->p2 & OPFLAG_NCHANGE ) p->nChange++; @@ -3154,11 +3156,12 @@ assert( pC!=0 ); if( pC->nullRow ){ pTos->flags = MEM_Null; }else if( pC->pCursor!=0 ){ BtCursor *pCrsr = pC->pCursor; - sqlite3VdbeCursorMoveto(pC); + rc = sqlite3VdbeCursorMoveto(pC); + if ( rc ) return rc; if( pC->nullRow ){ pTos->flags = MEM_Null; break; }else if( pC->keyAsData || pOp->opcode==OP_RowKey ){ i64 n64; @@ -3209,11 +3212,12 @@ i64 v; assert( i>=0 && inCursor ); pC = p->apCsr[i]; assert( pC!=0 ); - sqlite3VdbeCursorMoveto(pC); + rc = sqlite3VdbeCursorMoveto(pC); + if ( rc ) return rc; pTos++; if( pC->recnoIsValid ){ v = pC->lastRecno; }else if( pC->pseudoTable ){ v = keyToInt(pC->iKey); @@ -3255,11 +3259,12 @@ pTos->flags = MEM_Null; if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){ i64 amt; char *z; - sqlite3VdbeCursorMoveto(pC); + rc = sqlite3VdbeCursorMoveto(pC); + if ( rc ) return rc; assert( pC->intKey==0 ); sqlite3BtreeKeySize(pCrsr, &amt); if( amt<=0 ){ rc = SQLITE_CORRUPT; goto abort_due_to_error; Index: src/vdbeaux.c ================================================================== --- src/vdbeaux.c +++ src/vdbeaux.c @@ -1426,23 +1426,26 @@ ** MoveTo now. Return an error code. If no MoveTo is pending, this ** routine does nothing and returns SQLITE_OK. */ int sqlite3VdbeCursorMoveto(Cursor *p){ if( p->deferredMoveto ){ - int res; + int res, rc; extern int sqlite3_search_count; assert( p->intKey ); if( p->intKey ){ - sqlite3BtreeMoveto(p->pCursor, 0, p->movetoTarget, &res); + rc = sqlite3BtreeMoveto(p->pCursor, 0, p->movetoTarget, &res); }else{ - sqlite3BtreeMoveto(p->pCursor,(char*)&p->movetoTarget,sizeof(i64),&res); + rc = sqlite3BtreeMoveto(p->pCursor,(char*)&p->movetoTarget, + sizeof(i64),&res); } + if( rc ) return rc; *p->pIncrKey = 0; p->lastRecno = keyToInt(p->movetoTarget); p->recnoIsValid = res==0; if( res<0 ){ - sqlite3BtreeNext(p->pCursor, &res); + rc = sqlite3BtreeNext(p->pCursor, &res); + if( rc ) return rc; } sqlite3_search_count++; p->deferredMoveto = 0; p->cacheValid = 0; }