SQLite
Check-in [b724aa5889f2e09cf0cbef133a672e6486755104]
Not logged in
Overview
SHA1 Hash:b724aa5889f2e09cf0cbef133a672e6486755104
Date: 2013-04-01 14:29:33
User: dan
Comment:Fix a problem in btree.c that could cause a crash following an OOM.
Tags And Properties
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c

2592
2593
2594
2595
2596
2597
2598
2599

2600
2601
2602
2603
2604

2605
2606
2607
2608
2609
2610
2611

  for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
    if( pCsr->iPage>=0 ){
      MemPage *pPg = pCsr->apPage[0];
      if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
        MemPage *pNew = 0;
        rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
        if( rc==SQLITE_OK && pCsr->iPage==0 ){

          pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
        }
        pCsr->apPage[0] = pNew;
        releasePage(pPg);
        if( rc!=SQLITE_OK ) return rc;

      }
    }
  }

  return rc;
}








|
>
|
|
|
|
<
>







2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604

2605
2606
2607
2608
2609
2610
2611
2612

  for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
    if( pCsr->iPage>=0 ){
      MemPage *pPg = pCsr->apPage[0];
      if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
        MemPage *pNew = 0;
        rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
        if( rc==SQLITE_OK ){
          if( pCsr->iPage==0 ){
            pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
          }
          pCsr->apPage[0] = pNew;
          releasePage(pPg);

        }
      }
    }
  }

  return rc;
}