SQLite

Check-in [8aecf302a5]
Login

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

Overview
Comment:Make sure an OOM error on sqlite3PagerPagecount() is detected and reported out to the interface.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8aecf302a5aac66e43a8cc6c4e0d917f74e9e0de
User & Date: drh 2010-03-31 23:20:04.000
Context
2010-04-01
02:22
Restore the size information in the BtShared structure when a transaction rolls back. (check-in: 802aeb30c9 user: drh tags: trunk)
2010-03-31
23:20
Make sure an OOM error on sqlite3PagerPagecount() is detected and reported out to the interface. (check-in: 8aecf302a5 user: drh tags: trunk)
20:29
Report corruption if a database contains a reference that is out of range according to the filesize-in-header database size. (check-in: a91db0b1cd user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
4002
4003
4004
4005
4006
4007
4008
4009

4010
4011
4012
4013
4014
4015
4016
  
  /* If already in the error state, this function is a no-op.  But on
  ** the other hand, this routine is never called if we are already in
  ** an error state. */
  if( NEVER(pPager->errCode) ) return pPager->errCode;

  testcase( pPager->dbSizeValid==0 );
  sqlite3PagerPagecount(pPager, &nPage);

  pPager->pInJournal = sqlite3BitvecCreate(nPage);
  if( pPager->pInJournal==0 ){
    return SQLITE_NOMEM;
  }

  /* Open the journal file if it is not already open. */
  if( !isOpen(pPager->jfd) ){







|
>







4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
  
  /* If already in the error state, this function is a no-op.  But on
  ** the other hand, this routine is never called if we are already in
  ** an error state. */
  if( NEVER(pPager->errCode) ) return pPager->errCode;

  testcase( pPager->dbSizeValid==0 );
  rc = sqlite3PagerPagecount(pPager, &nPage);
  if( rc ) return rc;
  pPager->pInJournal = sqlite3BitvecCreate(nPage);
  if( pPager->pInJournal==0 ){
    return SQLITE_NOMEM;
  }

  /* Open the journal file if it is not already open. */
  if( !isOpen(pPager->jfd) ){