SQLite

Check-in [4f62dbcfc9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change code in OP_Rewind to avoid a valgrind warning following an error in the btree layer. This change does not fix any bug, just a warning.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | mistake
Files: files | file ages | folders
SHA1: 4f62dbcfc96855f69e71d163bfc051d9db08cca9
User & Date: dan 2010-07-03 05:56:09.000
Context
2010-07-03
08:01
Do not attempt to open a WAL file for an in-memory or temporary database. Even if the database header suggests that it is a WAL database. (check-in: 0fd8092436 user: dan tags: mistake)
05:56
Change code in OP_Rewind to avoid a valgrind warning following an error in the btree layer. This change does not fix any bug, just a warning. (check-in: 4f62dbcfc9 user: dan tags: mistake)
01:44
Fix a buffer overrun in the where.c. Problem detected by valgrind. (check-in: 15bb623306 user: drh tags: mistake)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
  assert( cursorHoldsMutex(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    if( pCur->eState==CURSOR_INVALID ){
      assert( pCur->apPage[pCur->iPage]->nCell==0 );
      *pRes = 1;
      rc = SQLITE_OK;
    }else{
      assert( pCur->apPage[pCur->iPage]->nCell>0 );
      *pRes = 0;
      rc = moveToLeftmost(pCur);
    }
  }
  return rc;







<







4244
4245
4246
4247
4248
4249
4250

4251
4252
4253
4254
4255
4256
4257
  assert( cursorHoldsMutex(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    if( pCur->eState==CURSOR_INVALID ){
      assert( pCur->apPage[pCur->iPage]->nCell==0 );
      *pRes = 1;

    }else{
      assert( pCur->apPage[pCur->iPage]->nCell>0 );
      *pRes = 0;
      rc = moveToLeftmost(pCur);
    }
  }
  return rc;
Changes to src/vdbe.c.
4134
4135
4136
4137
4138
4139
4140

4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
  VdbeCursor *pC;
  BtCursor *pCrsr;
  int res;

  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  assert( pC!=0 );

  if( (pCrsr = pC->pCursor)!=0 ){
    rc = sqlite3BtreeFirst(pCrsr, &res);
    pC->atFirst = res==0 ?1:0;
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
    pC->rowidIsValid = 0;
  }else{
    res = 1;
  }
  pC->nullRow = (u8)res;
  assert( pOp->p2>0 && pOp->p2<p->nOp );
  if( res ){
    pc = pOp->p2 - 1;
  }
  break;







>






<
<







4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147


4148
4149
4150
4151
4152
4153
4154
  VdbeCursor *pC;
  BtCursor *pCrsr;
  int res;

  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  assert( pC!=0 );
  res = 1;
  if( (pCrsr = pC->pCursor)!=0 ){
    rc = sqlite3BtreeFirst(pCrsr, &res);
    pC->atFirst = res==0 ?1:0;
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
    pC->rowidIsValid = 0;


  }
  pC->nullRow = (u8)res;
  assert( pOp->p2>0 && pOp->p2<p->nOp );
  if( res ){
    pc = pOp->p2 - 1;
  }
  break;